├── .github └── workflows │ ├── cd_chocolatey.yaml │ ├── cd_docker.yaml │ ├── cd_gemfury.yaml │ ├── cd_github.yaml │ └── cd_winget.yaml ├── .gitignore ├── LICENSE ├── README.md ├── build └── .gitignore ├── chocolatey-packages └── ipinfo │ ├── ipinfo.nuspec │ ├── tools │ └── chocolateyinstall.ps1 │ └── update.ps1 ├── cidr2ip ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── cidr2range ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── gif ├── 1k-ips.txt ├── README.md ├── bulk.cast ├── bulk.gif ├── cat-csv.cast ├── cat-csv.gif ├── cat.cast ├── cat.gif ├── default.cast ├── default.gif ├── hostname.cast ├── hostname.gif ├── ip8.8.8.8.cast ├── ip8.8.8.8.gif ├── ips.txt ├── myip.cast ├── myip.gif ├── summarize.cast └── summarize.gif ├── go.mod ├── go.sum ├── grepdomain ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── grepip ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── ipinfo ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── cache.go ├── cmd_asn.go ├── cmd_asn_bulk.go ├── cmd_asn_single.go ├── cmd_bulk.go ├── cmd_cache.go ├── cmd_calc.go ├── cmd_cidr2ip.go ├── cmd_cidr2range.go ├── cmd_completion.go ├── cmd_config.go ├── cmd_default.go ├── cmd_domain.go ├── cmd_download.go ├── cmd_grepdomain.go ├── cmd_grepip.go ├── cmd_init.go ├── cmd_ip.go ├── cmd_logout.go ├── cmd_map.go ├── cmd_match_ip.go ├── cmd_mmdb.go ├── cmd_mmdb_diff.go ├── cmd_mmdb_export.go ├── cmd_mmdb_import.go ├── cmd_mmdb_metadata.go ├── cmd_mmdb_read.go ├── cmd_mmdb_verify.go ├── cmd_myip.go ├── cmd_prips.go ├── cmd_quota.go ├── cmd_randip.go ├── cmd_range2cidr.go ├── cmd_range2ip.go ├── cmd_splitcidr.go ├── cmd_sum.go ├── cmd_tool.go ├── cmd_tool_aggregate.go ├── cmd_tool_ip2n.go ├── cmd_tool_isV4In6.go ├── cmd_tool_isValid.go ├── cmd_tool_is_global_unicast.go ├── cmd_tool_is_interface_local_multicast.go ├── cmd_tool_is_link_local_multicast.go ├── cmd_tool_is_link_local_unicast.go ├── cmd_tool_is_loopback.go ├── cmd_tool_is_multicast.go ├── cmd_tool_is_one_ip.go ├── cmd_tool_is_unspecified.go ├── cmd_tool_is_v4.go ├── cmd_tool_is_v6.go ├── cmd_tool_lower.go ├── cmd_tool_n2ip.go ├── cmd_tool_n2ip6.go ├── cmd_tool_next.go ├── cmd_tool_prefix.go ├── cmd_tool_prefix_addr.go ├── cmd_tool_prefix_bits.go ├── cmd_tool_prefix_isValid.go ├── cmd_tool_prefix_masked.go ├── cmd_tool_prev.go ├── cmd_tool_unmap.go ├── cmd_tool_upper.go ├── cmd_version.go ├── completions.go ├── config.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── init.go ├── ipinfo_client.go ├── macos.sh ├── main.go ├── release.sh ├── utils_output.go └── windows.ps1 ├── lib ├── cmd_asn_bulk.go ├── cmd_calc.go ├── cmd_cidr2ip.go ├── cmd_cidr2range.go ├── cmd_grepdomain.go ├── cmd_grepip.go ├── cmd_match_ip.go ├── cmd_prips.go ├── cmd_randip.go ├── cmd_range2cidr.go ├── cmd_range2ip.go ├── cmd_splitcidr.go ├── cmd_tool_aggregate.go ├── cmd_tool_ip2n.go ├── cmd_tool_isV4In6.go ├── cmd_tool_is_global_unicast.go ├── cmd_tool_is_interface_local_multicast.go ├── cmd_tool_is_link_local_multicast.go ├── cmd_tool_is_link_local_unicast.go ├── cmd_tool_is_loopback.go ├── cmd_tool_is_multicast.go ├── cmd_tool_is_one_ip.go ├── cmd_tool_is_unspecified.go ├── cmd_tool_is_v4.go ├── cmd_tool_is_v6.go ├── cmd_tool_lower.go ├── cmd_tool_n2ip.go ├── cmd_tool_n2ip6.go ├── cmd_tool_next.go ├── cmd_tool_prefix_addr.go ├── cmd_tool_prefix_bits.go ├── cmd_tool_prefix_masked.go ├── cmd_tool_prefix_valid.go ├── cmd_tool_prev.go ├── cmd_tool_unmap.go ├── cmd_tool_upper.go ├── cmd_tool_valid.go ├── complete │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── arg.go │ ├── arg_test.go │ ├── command.go │ ├── complete.go │ ├── install │ │ ├── bash.go │ │ ├── fish.go │ │ ├── install.go │ │ ├── utils.go │ │ └── zsh.go │ ├── predict │ │ ├── files.go │ │ ├── files_test.go │ │ ├── options.go │ │ ├── options_test.go │ │ ├── predict.go │ │ ├── predict_test.go │ │ └── testdata │ │ │ ├── .dot.txt │ │ │ ├── a.txt │ │ │ ├── b.txt │ │ │ ├── c.txt │ │ │ ├── dir │ │ │ ├── bar │ │ │ └── foo │ │ │ ├── outer │ │ │ └── inner │ │ │ │ └── readme.md │ │ │ └── readme.md │ ├── testing.go │ └── tokener.go ├── domain.go ├── help_detailed.go ├── iputil │ ├── asn_str.go │ ├── bogon.go │ ├── cidr.go │ ├── errors.go │ ├── file.go │ ├── init.go │ ├── ip.go │ ├── ip6.go │ ├── ip6_range.go │ ├── ip6_range_str.go │ ├── ip6_str.go │ ├── ip6_subnet.go │ ├── ip6_subnet_str.go │ ├── ip_conversions.go │ ├── ip_list.go │ ├── ip_list_write.go │ ├── ip_math.go │ ├── ip_range.go │ ├── ip_range_str.go │ ├── ip_range_test.go │ ├── ip_str.go │ ├── ip_subnet.go │ ├── ip_subnet_str.go │ ├── ip_subnet_test.go │ ├── regex.go │ ├── string_slice.go │ ├── u128.go │ └── utils_input.go └── stack.go ├── matchip ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── prips ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── randip ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── range2cidr ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── range2ip ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 ├── scripts ├── build-all-platforms.sh ├── build-archive-all.sh ├── build.sh ├── changelog.sh ├── ctags.sh ├── docker.sh ├── fmt.sh ├── lint.sh ├── release-ppa.sh └── release.sh ├── splitcidr ├── CHANGELOG.md ├── Dockerfile ├── build-all-platforms.sh ├── build.sh ├── completions.go ├── deb.sh ├── dist │ └── DEBIAN │ │ └── control ├── docker.sh ├── macos.sh ├── main.go ├── release.sh └── windows.ps1 └── vendor ├── github.com ├── davecgh │ └── go-spew │ │ ├── LICENSE │ │ └── spew │ │ ├── bypass.go │ │ ├── bypasssafe.go │ │ ├── common.go │ │ ├── config.go │ │ ├── doc.go │ │ ├── dump.go │ │ ├── format.go │ │ └── spew.go ├── fatih │ └── color │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── color.go │ │ ├── color_windows.go │ │ └── doc.go ├── hashicorp │ ├── errwrap │ │ ├── LICENSE │ │ ├── README.md │ │ └── errwrap.go │ └── go-multierror │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── append.go │ │ ├── flatten.go │ │ ├── format.go │ │ ├── group.go │ │ ├── multierror.go │ │ ├── prefix.go │ │ └── sort.go ├── ipinfo │ ├── go │ │ └── v2 │ │ │ ├── LICENSE │ │ │ └── ipinfo │ │ │ ├── asn.go │ │ │ ├── batch.go │ │ │ ├── bogon.go │ │ │ ├── cache.go │ │ │ ├── cache │ │ │ ├── in_memory.go │ │ │ └── interface.go │ │ │ ├── client.go │ │ │ ├── core.go │ │ │ ├── countries.go │ │ │ ├── doc.go │ │ │ ├── ipinfo.go │ │ │ ├── map.go │ │ │ └── summary.go │ └── mmdbctl │ │ ├── LICENSE │ │ └── lib │ │ ├── cmd_diff.go │ │ ├── cmd_export.go │ │ ├── cmd_import.go │ │ ├── cmd_metadata.go │ │ ├── cmd_read.go │ │ ├── cmd_verify.go │ │ ├── reader.go │ │ ├── reader_tsv.go │ │ ├── utils.go │ │ ├── writer.go │ │ └── writer_tsv.go ├── jszwec │ └── csvutil │ │ ├── .appveyor.yml │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── _config.yml │ │ ├── cache.go │ │ ├── cache_go17.go │ │ ├── cache_go19.go │ │ ├── csvutil.go │ │ ├── csvutil_go17.go │ │ ├── csvutil_go19.go │ │ ├── decode.go │ │ ├── decoder.go │ │ ├── doc.go │ │ ├── encode.go │ │ ├── encoder.go │ │ ├── error.go │ │ ├── interface.go │ │ └── tag.go ├── mattn │ ├── go-colorable │ │ ├── LICENSE │ │ ├── README.md │ │ ├── colorable_appengine.go │ │ ├── colorable_others.go │ │ ├── colorable_windows.go │ │ ├── go.test.sh │ │ └── noncolorable.go │ └── go-isatty │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── go.test.sh │ │ ├── isatty_bsd.go │ │ ├── isatty_others.go │ │ ├── isatty_plan9.go │ │ ├── isatty_solaris.go │ │ ├── isatty_tcgets.go │ │ └── isatty_windows.go ├── maxmind │ └── mmdbwriter │ │ ├── .gitignore │ │ ├── .golangci.toml │ │ ├── LICENSE-APACHE │ │ ├── LICENSE-MIT │ │ ├── README.md │ │ ├── data_key.go │ │ ├── data_map.go │ │ ├── data_section.go │ │ ├── deserializer.go │ │ ├── errors.go │ │ ├── inserter │ │ └── inserter.go │ │ ├── mmdbtype │ │ └── types.go │ │ ├── node.go │ │ ├── reserved.go │ │ └── tree.go ├── oschwald │ └── maxminddb-golang │ │ ├── .gitignore │ │ ├── .gitmodules │ │ ├── .golangci.toml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── decoder.go │ │ ├── deserializer.go │ │ ├── errors.go │ │ ├── mmap_unix.go │ │ ├── mmap_windows.go │ │ ├── node.go │ │ ├── reader.go │ │ ├── reader_memory.go │ │ ├── reader_mmap.go │ │ ├── set_zero_120.go │ │ ├── set_zero_pre120.go │ │ ├── traverse.go │ │ └── verifier.go ├── patrickmn │ └── go-cache │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cache.go │ │ └── sharded.go ├── pkg │ └── browser │ │ ├── LICENSE │ │ ├── README.md │ │ ├── browser.go │ │ ├── browser_darwin.go │ │ ├── browser_freebsd.go │ │ ├── browser_linux.go │ │ ├── browser_openbsd.go │ │ ├── browser_unsupported.go │ │ ├── browser_windows.go │ │ └── zbrowser_windows.go ├── pmezard │ └── go-difflib │ │ ├── LICENSE │ │ └── difflib │ │ └── difflib.go ├── posener │ └── script │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cat.go │ │ ├── cut.go │ │ ├── exec.go │ │ ├── from.go │ │ ├── grep.go │ │ ├── head.go │ │ ├── ls.go │ │ ├── modify.go │ │ ├── sort.go │ │ ├── stream.go │ │ ├── to.go │ │ ├── uniq.go │ │ └── wc.go ├── spf13 │ └── pflag │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bool.go │ │ ├── bool_slice.go │ │ ├── bytes.go │ │ ├── count.go │ │ ├── duration.go │ │ ├── duration_slice.go │ │ ├── flag.go │ │ ├── float32.go │ │ ├── float32_slice.go │ │ ├── float64.go │ │ ├── float64_slice.go │ │ ├── golangflag.go │ │ ├── int.go │ │ ├── int16.go │ │ ├── int32.go │ │ ├── int32_slice.go │ │ ├── int64.go │ │ ├── int64_slice.go │ │ ├── int8.go │ │ ├── int_slice.go │ │ ├── ip.go │ │ ├── ip_slice.go │ │ ├── ipmask.go │ │ ├── ipnet.go │ │ ├── string.go │ │ ├── string_array.go │ │ ├── string_slice.go │ │ ├── string_to_int.go │ │ ├── string_to_int64.go │ │ ├── string_to_string.go │ │ ├── uint.go │ │ ├── uint16.go │ │ ├── uint32.go │ │ ├── uint64.go │ │ ├── uint8.go │ │ └── uint_slice.go └── stretchr │ └── testify │ ├── LICENSE │ └── assert │ ├── assertion_compare.go │ ├── assertion_compare_can_convert.go │ ├── assertion_compare_legacy.go │ ├── assertion_format.go │ ├── assertion_format.go.tmpl │ ├── assertion_forward.go │ ├── assertion_forward.go.tmpl │ ├── assertion_order.go │ ├── assertions.go │ ├── doc.go │ ├── errors.go │ ├── forward_assertions.go │ └── http_assertions.go ├── go.etcd.io └── bbolt │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── bolt_386.go │ ├── bolt_amd64.go │ ├── bolt_arm.go │ ├── bolt_arm64.go │ ├── bolt_linux.go │ ├── bolt_mips64x.go │ ├── bolt_mipsx.go │ ├── bolt_openbsd.go │ ├── bolt_ppc.go │ ├── bolt_ppc64.go │ ├── bolt_ppc64le.go │ ├── bolt_riscv64.go │ ├── bolt_s390x.go │ ├── bolt_unix.go │ ├── bolt_unix_aix.go │ ├── bolt_unix_solaris.go │ ├── bolt_windows.go │ ├── boltsync_unix.go │ ├── bucket.go │ ├── compact.go │ ├── cursor.go │ ├── db.go │ ├── doc.go │ ├── errors.go │ ├── freelist.go │ ├── freelist_hmap.go │ ├── mlock_unix.go │ ├── mlock_windows.go │ ├── node.go │ ├── page.go │ ├── tx.go │ └── unsafe.go ├── go4.org └── netipx │ ├── .gitignore │ ├── .gitmodules │ ├── AUTHORS │ ├── LICENSE │ ├── README.md │ ├── ipset.go │ ├── mask6.go │ ├── netipx.go │ └── uint128.go ├── golang.org └── x │ ├── exp │ ├── LICENSE │ ├── PATENTS │ ├── constraints │ │ └── constraints.go │ └── slices │ │ ├── cmp.go │ │ ├── slices.go │ │ ├── sort.go │ │ ├── zsortanyfunc.go │ │ └── zsortordered.go │ ├── net │ ├── LICENSE │ ├── PATENTS │ └── idna │ │ ├── go118.go │ │ ├── idna10.0.0.go │ │ ├── idna9.0.0.go │ │ ├── pre_go118.go │ │ ├── punycode.go │ │ ├── tables10.0.0.go │ │ ├── tables11.0.0.go │ │ ├── tables12.0.0.go │ │ ├── tables13.0.0.go │ │ ├── tables15.0.0.go │ │ ├── tables9.0.0.go │ │ ├── trie.go │ │ ├── trie12.0.0.go │ │ ├── trie13.0.0.go │ │ └── trieval.go │ ├── sync │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── errgroup │ │ └── errgroup.go │ ├── sys │ ├── LICENSE │ ├── PATENTS │ ├── plan9 │ │ ├── asm.s │ │ ├── asm_plan9_386.s │ │ ├── asm_plan9_amd64.s │ │ ├── asm_plan9_arm.s │ │ ├── const_plan9.go │ │ ├── dir_plan9.go │ │ ├── env_plan9.go │ │ ├── errors_plan9.go │ │ ├── mkall.sh │ │ ├── mkerrors.sh │ │ ├── mksysnum_plan9.sh │ │ ├── pwd_go15_plan9.go │ │ ├── pwd_plan9.go │ │ ├── race.go │ │ ├── race0.go │ │ ├── str.go │ │ ├── syscall.go │ │ ├── syscall_plan9.go │ │ ├── zsyscall_plan9_386.go │ │ ├── zsyscall_plan9_amd64.go │ │ ├── zsyscall_plan9_arm.go │ │ └── zsysnum_plan9.go │ ├── unix │ │ ├── .gitignore │ │ ├── README.md │ │ ├── affinity_linux.go │ │ ├── aliases.go │ │ ├── asm_aix_ppc64.s │ │ ├── asm_bsd_386.s │ │ ├── asm_bsd_amd64.s │ │ ├── asm_bsd_arm.s │ │ ├── asm_bsd_arm64.s │ │ ├── asm_bsd_ppc64.s │ │ ├── asm_bsd_riscv64.s │ │ ├── asm_linux_386.s │ │ ├── asm_linux_amd64.s │ │ ├── asm_linux_arm.s │ │ ├── asm_linux_arm64.s │ │ ├── asm_linux_loong64.s │ │ ├── asm_linux_mips64x.s │ │ ├── asm_linux_mipsx.s │ │ ├── asm_linux_ppc64x.s │ │ ├── asm_linux_riscv64.s │ │ ├── asm_linux_s390x.s │ │ ├── asm_openbsd_mips64.s │ │ ├── asm_solaris_amd64.s │ │ ├── asm_zos_s390x.s │ │ ├── bluetooth_linux.go │ │ ├── cap_freebsd.go │ │ ├── constants.go │ │ ├── dev_aix_ppc.go │ │ ├── dev_aix_ppc64.go │ │ ├── dev_darwin.go │ │ ├── dev_dragonfly.go │ │ ├── dev_freebsd.go │ │ ├── dev_linux.go │ │ ├── dev_netbsd.go │ │ ├── dev_openbsd.go │ │ ├── dev_zos.go │ │ ├── dirent.go │ │ ├── endian_big.go │ │ ├── endian_little.go │ │ ├── env_unix.go │ │ ├── epoll_zos.go │ │ ├── fcntl.go │ │ ├── fcntl_darwin.go │ │ ├── fcntl_linux_32bit.go │ │ ├── fdset.go │ │ ├── fstatfs_zos.go │ │ ├── gccgo.go │ │ ├── gccgo_c.c │ │ ├── gccgo_linux_amd64.go │ │ ├── ifreq_linux.go │ │ ├── ioctl_linux.go │ │ ├── ioctl_signed.go │ │ ├── ioctl_unsigned.go │ │ ├── ioctl_zos.go │ │ ├── mkall.sh │ │ ├── mkerrors.sh │ │ ├── mmap_nomremap.go │ │ ├── mremap.go │ │ ├── pagesize_unix.go │ │ ├── pledge_openbsd.go │ │ ├── ptrace_darwin.go │ │ ├── ptrace_ios.go │ │ ├── race.go │ │ ├── race0.go │ │ ├── readdirent_getdents.go │ │ ├── readdirent_getdirentries.go │ │ ├── sockcmsg_dragonfly.go │ │ ├── sockcmsg_linux.go │ │ ├── sockcmsg_unix.go │ │ ├── sockcmsg_unix_other.go │ │ ├── syscall.go │ │ ├── syscall_aix.go │ │ ├── syscall_aix_ppc.go │ │ ├── syscall_aix_ppc64.go │ │ ├── syscall_bsd.go │ │ ├── syscall_darwin.go │ │ ├── syscall_darwin_amd64.go │ │ ├── syscall_darwin_arm64.go │ │ ├── syscall_darwin_libSystem.go │ │ ├── syscall_dragonfly.go │ │ ├── syscall_dragonfly_amd64.go │ │ ├── syscall_freebsd.go │ │ ├── syscall_freebsd_386.go │ │ ├── syscall_freebsd_amd64.go │ │ ├── syscall_freebsd_arm.go │ │ ├── syscall_freebsd_arm64.go │ │ ├── syscall_freebsd_riscv64.go │ │ ├── syscall_hurd.go │ │ ├── syscall_hurd_386.go │ │ ├── syscall_illumos.go │ │ ├── syscall_linux.go │ │ ├── syscall_linux_386.go │ │ ├── syscall_linux_alarm.go │ │ ├── syscall_linux_amd64.go │ │ ├── syscall_linux_amd64_gc.go │ │ ├── syscall_linux_arm.go │ │ ├── syscall_linux_arm64.go │ │ ├── syscall_linux_gc.go │ │ ├── syscall_linux_gc_386.go │ │ ├── syscall_linux_gc_arm.go │ │ ├── syscall_linux_gccgo_386.go │ │ ├── syscall_linux_gccgo_arm.go │ │ ├── syscall_linux_loong64.go │ │ ├── syscall_linux_mips64x.go │ │ ├── syscall_linux_mipsx.go │ │ ├── syscall_linux_ppc.go │ │ ├── syscall_linux_ppc64x.go │ │ ├── syscall_linux_riscv64.go │ │ ├── syscall_linux_s390x.go │ │ ├── syscall_linux_sparc64.go │ │ ├── syscall_netbsd.go │ │ ├── syscall_netbsd_386.go │ │ ├── syscall_netbsd_amd64.go │ │ ├── syscall_netbsd_arm.go │ │ ├── syscall_netbsd_arm64.go │ │ ├── syscall_openbsd.go │ │ ├── syscall_openbsd_386.go │ │ ├── syscall_openbsd_amd64.go │ │ ├── syscall_openbsd_arm.go │ │ ├── syscall_openbsd_arm64.go │ │ ├── syscall_openbsd_libc.go │ │ ├── syscall_openbsd_mips64.go │ │ ├── syscall_openbsd_ppc64.go │ │ ├── syscall_openbsd_riscv64.go │ │ ├── syscall_solaris.go │ │ ├── syscall_solaris_amd64.go │ │ ├── syscall_unix.go │ │ ├── syscall_unix_gc.go │ │ ├── syscall_unix_gc_ppc64x.go │ │ ├── syscall_zos_s390x.go │ │ ├── sysvshm_linux.go │ │ ├── sysvshm_unix.go │ │ ├── sysvshm_unix_other.go │ │ ├── timestruct.go │ │ ├── unveil_openbsd.go │ │ ├── xattr_bsd.go │ │ ├── zerrors_aix_ppc.go │ │ ├── zerrors_aix_ppc64.go │ │ ├── zerrors_darwin_amd64.go │ │ ├── zerrors_darwin_arm64.go │ │ ├── zerrors_dragonfly_amd64.go │ │ ├── zerrors_freebsd_386.go │ │ ├── zerrors_freebsd_amd64.go │ │ ├── zerrors_freebsd_arm.go │ │ ├── zerrors_freebsd_arm64.go │ │ ├── zerrors_freebsd_riscv64.go │ │ ├── zerrors_linux.go │ │ ├── zerrors_linux_386.go │ │ ├── zerrors_linux_amd64.go │ │ ├── zerrors_linux_arm.go │ │ ├── zerrors_linux_arm64.go │ │ ├── zerrors_linux_loong64.go │ │ ├── zerrors_linux_mips.go │ │ ├── zerrors_linux_mips64.go │ │ ├── zerrors_linux_mips64le.go │ │ ├── zerrors_linux_mipsle.go │ │ ├── zerrors_linux_ppc.go │ │ ├── zerrors_linux_ppc64.go │ │ ├── zerrors_linux_ppc64le.go │ │ ├── zerrors_linux_riscv64.go │ │ ├── zerrors_linux_s390x.go │ │ ├── zerrors_linux_sparc64.go │ │ ├── zerrors_netbsd_386.go │ │ ├── zerrors_netbsd_amd64.go │ │ ├── zerrors_netbsd_arm.go │ │ ├── zerrors_netbsd_arm64.go │ │ ├── zerrors_openbsd_386.go │ │ ├── zerrors_openbsd_amd64.go │ │ ├── zerrors_openbsd_arm.go │ │ ├── zerrors_openbsd_arm64.go │ │ ├── zerrors_openbsd_mips64.go │ │ ├── zerrors_openbsd_ppc64.go │ │ ├── zerrors_openbsd_riscv64.go │ │ ├── zerrors_solaris_amd64.go │ │ ├── zerrors_zos_s390x.go │ │ ├── zptrace_armnn_linux.go │ │ ├── zptrace_linux_arm64.go │ │ ├── zptrace_mipsnn_linux.go │ │ ├── zptrace_mipsnnle_linux.go │ │ ├── zptrace_x86_linux.go │ │ ├── zsyscall_aix_ppc.go │ │ ├── zsyscall_aix_ppc64.go │ │ ├── zsyscall_aix_ppc64_gc.go │ │ ├── zsyscall_aix_ppc64_gccgo.go │ │ ├── zsyscall_darwin_amd64.go │ │ ├── zsyscall_darwin_amd64.s │ │ ├── zsyscall_darwin_arm64.go │ │ ├── zsyscall_darwin_arm64.s │ │ ├── zsyscall_dragonfly_amd64.go │ │ ├── zsyscall_freebsd_386.go │ │ ├── zsyscall_freebsd_amd64.go │ │ ├── zsyscall_freebsd_arm.go │ │ ├── zsyscall_freebsd_arm64.go │ │ ├── zsyscall_freebsd_riscv64.go │ │ ├── zsyscall_illumos_amd64.go │ │ ├── zsyscall_linux.go │ │ ├── zsyscall_linux_386.go │ │ ├── zsyscall_linux_amd64.go │ │ ├── zsyscall_linux_arm.go │ │ ├── zsyscall_linux_arm64.go │ │ ├── zsyscall_linux_loong64.go │ │ ├── zsyscall_linux_mips.go │ │ ├── zsyscall_linux_mips64.go │ │ ├── zsyscall_linux_mips64le.go │ │ ├── zsyscall_linux_mipsle.go │ │ ├── zsyscall_linux_ppc.go │ │ ├── zsyscall_linux_ppc64.go │ │ ├── zsyscall_linux_ppc64le.go │ │ ├── zsyscall_linux_riscv64.go │ │ ├── zsyscall_linux_s390x.go │ │ ├── zsyscall_linux_sparc64.go │ │ ├── zsyscall_netbsd_386.go │ │ ├── zsyscall_netbsd_amd64.go │ │ ├── zsyscall_netbsd_arm.go │ │ ├── zsyscall_netbsd_arm64.go │ │ ├── zsyscall_openbsd_386.go │ │ ├── zsyscall_openbsd_386.s │ │ ├── zsyscall_openbsd_amd64.go │ │ ├── zsyscall_openbsd_amd64.s │ │ ├── zsyscall_openbsd_arm.go │ │ ├── zsyscall_openbsd_arm.s │ │ ├── zsyscall_openbsd_arm64.go │ │ ├── zsyscall_openbsd_arm64.s │ │ ├── zsyscall_openbsd_mips64.go │ │ ├── zsyscall_openbsd_mips64.s │ │ ├── zsyscall_openbsd_ppc64.go │ │ ├── zsyscall_openbsd_ppc64.s │ │ ├── zsyscall_openbsd_riscv64.go │ │ ├── zsyscall_openbsd_riscv64.s │ │ ├── zsyscall_solaris_amd64.go │ │ ├── zsyscall_zos_s390x.go │ │ ├── zsysctl_openbsd_386.go │ │ ├── zsysctl_openbsd_amd64.go │ │ ├── zsysctl_openbsd_arm.go │ │ ├── zsysctl_openbsd_arm64.go │ │ ├── zsysctl_openbsd_mips64.go │ │ ├── zsysctl_openbsd_ppc64.go │ │ ├── zsysctl_openbsd_riscv64.go │ │ ├── zsysnum_darwin_amd64.go │ │ ├── zsysnum_darwin_arm64.go │ │ ├── zsysnum_dragonfly_amd64.go │ │ ├── zsysnum_freebsd_386.go │ │ ├── zsysnum_freebsd_amd64.go │ │ ├── zsysnum_freebsd_arm.go │ │ ├── zsysnum_freebsd_arm64.go │ │ ├── zsysnum_freebsd_riscv64.go │ │ ├── zsysnum_linux_386.go │ │ ├── zsysnum_linux_amd64.go │ │ ├── zsysnum_linux_arm.go │ │ ├── zsysnum_linux_arm64.go │ │ ├── zsysnum_linux_loong64.go │ │ ├── zsysnum_linux_mips.go │ │ ├── zsysnum_linux_mips64.go │ │ ├── zsysnum_linux_mips64le.go │ │ ├── zsysnum_linux_mipsle.go │ │ ├── zsysnum_linux_ppc.go │ │ ├── zsysnum_linux_ppc64.go │ │ ├── zsysnum_linux_ppc64le.go │ │ ├── zsysnum_linux_riscv64.go │ │ ├── zsysnum_linux_s390x.go │ │ ├── zsysnum_linux_sparc64.go │ │ ├── zsysnum_netbsd_386.go │ │ ├── zsysnum_netbsd_amd64.go │ │ ├── zsysnum_netbsd_arm.go │ │ ├── zsysnum_netbsd_arm64.go │ │ ├── zsysnum_openbsd_386.go │ │ ├── zsysnum_openbsd_amd64.go │ │ ├── zsysnum_openbsd_arm.go │ │ ├── zsysnum_openbsd_arm64.go │ │ ├── zsysnum_openbsd_mips64.go │ │ ├── zsysnum_openbsd_ppc64.go │ │ ├── zsysnum_openbsd_riscv64.go │ │ ├── zsysnum_zos_s390x.go │ │ ├── ztypes_aix_ppc.go │ │ ├── ztypes_aix_ppc64.go │ │ ├── ztypes_darwin_amd64.go │ │ ├── ztypes_darwin_arm64.go │ │ ├── ztypes_dragonfly_amd64.go │ │ ├── ztypes_freebsd_386.go │ │ ├── ztypes_freebsd_amd64.go │ │ ├── ztypes_freebsd_arm.go │ │ ├── ztypes_freebsd_arm64.go │ │ ├── ztypes_freebsd_riscv64.go │ │ ├── ztypes_linux.go │ │ ├── ztypes_linux_386.go │ │ ├── ztypes_linux_amd64.go │ │ ├── ztypes_linux_arm.go │ │ ├── ztypes_linux_arm64.go │ │ ├── ztypes_linux_loong64.go │ │ ├── ztypes_linux_mips.go │ │ ├── ztypes_linux_mips64.go │ │ ├── ztypes_linux_mips64le.go │ │ ├── ztypes_linux_mipsle.go │ │ ├── ztypes_linux_ppc.go │ │ ├── ztypes_linux_ppc64.go │ │ ├── ztypes_linux_ppc64le.go │ │ ├── ztypes_linux_riscv64.go │ │ ├── ztypes_linux_s390x.go │ │ ├── ztypes_linux_sparc64.go │ │ ├── ztypes_netbsd_386.go │ │ ├── ztypes_netbsd_amd64.go │ │ ├── ztypes_netbsd_arm.go │ │ ├── ztypes_netbsd_arm64.go │ │ ├── ztypes_openbsd_386.go │ │ ├── ztypes_openbsd_amd64.go │ │ ├── ztypes_openbsd_arm.go │ │ ├── ztypes_openbsd_arm64.go │ │ ├── ztypes_openbsd_mips64.go │ │ ├── ztypes_openbsd_ppc64.go │ │ ├── ztypes_openbsd_riscv64.go │ │ ├── ztypes_solaris_amd64.go │ │ └── ztypes_zos_s390x.go │ └── windows │ │ ├── aliases.go │ │ ├── dll_windows.go │ │ ├── empty.s │ │ ├── env_windows.go │ │ ├── eventlog.go │ │ ├── exec_windows.go │ │ ├── memory_windows.go │ │ ├── mkerrors.bash │ │ ├── mkknownfolderids.bash │ │ ├── mksyscall.go │ │ ├── race.go │ │ ├── race0.go │ │ ├── security_windows.go │ │ ├── service.go │ │ ├── setupapi_windows.go │ │ ├── str.go │ │ ├── syscall.go │ │ ├── syscall_windows.go │ │ ├── types_windows.go │ │ ├── types_windows_386.go │ │ ├── types_windows_amd64.go │ │ ├── types_windows_arm.go │ │ ├── types_windows_arm64.go │ │ ├── zerrors_windows.go │ │ ├── zknownfolderids_windows.go │ │ └── zsyscall_windows.go │ ├── term │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── PATENTS │ ├── README.md │ ├── codereview.cfg │ ├── term.go │ ├── term_plan9.go │ ├── term_unix.go │ ├── term_unix_bsd.go │ ├── term_unix_other.go │ ├── term_unsupported.go │ ├── term_windows.go │ └── terminal.go │ └── text │ ├── LICENSE │ ├── PATENTS │ ├── secure │ └── bidirule │ │ ├── bidirule.go │ │ ├── bidirule10.0.0.go │ │ └── bidirule9.0.0.go │ ├── transform │ └── transform.go │ └── unicode │ ├── bidi │ ├── bidi.go │ ├── bracket.go │ ├── core.go │ ├── prop.go │ ├── tables10.0.0.go │ ├── tables11.0.0.go │ ├── tables12.0.0.go │ ├── tables13.0.0.go │ ├── tables15.0.0.go │ ├── tables9.0.0.go │ └── trieval.go │ └── norm │ ├── composition.go │ ├── forminfo.go │ ├── input.go │ ├── iter.go │ ├── normalize.go │ ├── readwriter.go │ ├── tables10.0.0.go │ ├── tables11.0.0.go │ ├── tables12.0.0.go │ ├── tables13.0.0.go │ ├── tables15.0.0.go │ ├── tables9.0.0.go │ ├── transform.go │ └── trie.go ├── gopkg.in └── yaml.v3 │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── emitterc.go │ ├── encode.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── modules.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .vim/ 2 | tmp/ 3 | 4 | !ipinfo/dist/DEBIAN/ 5 | !grepip/dist/DEBIAN/ 6 | !grepdomain/dist/DEBIAN/ 7 | !prips/dist/DEBIAN/ 8 | !cidr2range/dist/DEBIAN/ 9 | !cidr2ip/dist/DEBIAN/ 10 | !range2cidr/dist/DEBIAN/ 11 | !range2ip/dist/DEBIAN/ 12 | !randip/dist/DEBIAN/ 13 | ipinfo/dist/ 14 | grepip/dist/ 15 | grepdomain/dist/ 16 | matchip/dist/ 17 | prips/dist/ 18 | cidr2range/dist/ 19 | cidr2ip/dist/ 20 | range2cidr/dist/ 21 | range2ip/dist/ 22 | randip/dist/ 23 | splitcidr/dist/ 24 | *.mmdb 25 | *.gz 26 | -------------------------------------------------------------------------------- /build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /chocolatey-packages/ipinfo/tools/chocolateyinstall.ps1: -------------------------------------------------------------------------------- 1 | $ErrorActionPreference = 'Stop'; 2 | 3 | $packageName = 'ipinfo' 4 | $toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition 5 | 6 | $packageArgs = @{ 7 | packageName = $packageName 8 | url64 = '' 9 | checksum64 = '' 10 | checksumType64 = '' 11 | url = '' 12 | checksumType = '' 13 | checksum = '' 14 | destination = $toolsDir 15 | } 16 | 17 | $targetPath = Join-Path -Path $toolsDir -ChildPath "ipinfo.exe" 18 | if (Test-Path $targetPath) { 19 | Remove-Item $targetPath 20 | } 21 | Install-ChocolateyZipPackage @packageArgs 22 | Get-ChildItem -Path $toolsDir -Filter "ipinfo*.exe" | Rename-Item -NewName "ipinfo.exe" 23 | -------------------------------------------------------------------------------- /cidr2ip/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | * `cidr2ip` converts CIDRs to individual IPs within those CIDRs. 4 | * The command exists as a standalone binary in addition to as a subcommand on the 5 | main `ipinfo` command. 6 | * `cidr2ip` accepts inputs the same way our other commands do, via stdin, args, 7 | files, etc. 8 | -------------------------------------------------------------------------------- /cidr2ip/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /cidr2ip 5 | COPY build/cidr2ip ./ 6 | ENTRYPOINT ["/cidr2ip/cidr2ip"] 7 | -------------------------------------------------------------------------------- /cidr2ip/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "cidr2ip" $VSN 13 | -------------------------------------------------------------------------------- /cidr2ip/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "cidr2ip" 11 | -------------------------------------------------------------------------------- /cidr2ip/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-v": predict.Nothing, 11 | "--version": predict.Nothing, 12 | "-h": predict.Nothing, 13 | "--help": predict.Nothing, 14 | "--completions-install": predict.Nothing, 15 | "--completions-bash": predict.Nothing, 16 | "--completions-zsh": predict.Nothing, 17 | "--completions-fish": predict.Nothing, 18 | }, 19 | } 20 | 21 | func handleCompletions() { 22 | completions.Complete(progBase) 23 | } 24 | -------------------------------------------------------------------------------- /cidr2ip/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.0.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | 25 | curl -LO https://github.com/ipinfo/cli/releases/download/cidr2ip-${VSN}/cidr2ip_${VSN}_linux_${ARCH_NAME}.deb 26 | if command -v sudo >/dev/null 2>&1; then 27 | sudo dpkg -i cidr2ip_${VSN}_linux_${ARCH_NAME}.deb 28 | else 29 | dpkg -i cidr2ip_${VSN}_linux_${ARCH_NAME}.deb 30 | fi 31 | rm cidr2ip_${VSN}_linux_${ARCH_NAME}.deb 32 | 33 | echo 34 | echo 'You can now run `cidr2ip`'. 35 | 36 | if [ -f "$0" ]; then 37 | rm $0 38 | fi 39 | -------------------------------------------------------------------------------- /cidr2ip/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: cidr2ip 2 | Section: utils 3 | Version: 1.0.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: cidr2ip 10 | Architecture: amd64 11 | Description: A simple tool for converting from CIDRs to to individual IPs within those CIDRs. 12 | -------------------------------------------------------------------------------- /cidr2ip/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "cidr2ip" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /cidr2ip/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.0.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/cidr2ip-${VSN}/cidr2ip_${VSN}_${PLAT}.tar.gz 9 | tar -xf cidr2ip_${VSN}_${PLAT}.tar.gz 10 | rm cidr2ip_${VSN}_${PLAT}.tar.gz 11 | sudo mv cidr2ip_${VSN}_${PLAT} /usr/local/bin/cidr2ip 12 | 13 | echo 14 | echo 'You can now run `cidr2ip`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /cidr2ip/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "cidr2ip" $VSN 13 | -------------------------------------------------------------------------------- /cidr2range/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.2.0 2 | 3 | * When `cidr2range` accepts a file, it now also looks to see if there is a 4 | header in CSV form, and if so changes the first column to range, just as it 5 | changes the first non-header columns from CIDRs to IP ranges. 6 | -------------------------------------------------------------------------------- /cidr2range/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /cidr2range 5 | COPY build/cidr2range ./ 6 | ENTRYPOINT ["/cidr2range/cidr2range"] 7 | -------------------------------------------------------------------------------- /cidr2range/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "cidr2range" $VSN 13 | -------------------------------------------------------------------------------- /cidr2range/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "cidr2range" 11 | -------------------------------------------------------------------------------- /cidr2range/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-v": predict.Nothing, 11 | "--version": predict.Nothing, 12 | "-h": predict.Nothing, 13 | "--help": predict.Nothing, 14 | "--completions-install": predict.Nothing, 15 | "--completions-bash": predict.Nothing, 16 | "--completions-zsh": predict.Nothing, 17 | "--completions-fish": predict.Nothing, 18 | }, 19 | } 20 | 21 | func handleCompletions() { 22 | completions.Complete(progBase) 23 | } 24 | -------------------------------------------------------------------------------- /cidr2range/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.2.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/cidr2range-${VSN}/cidr2range_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i cidr2range_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i cidr2range_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm cidr2range_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `cidr2range`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /cidr2range/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: cidr2range 2 | Section: utils 3 | Version: 1.2.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: cidr2range 10 | Architecture: amd64 11 | Description: A simple tool for converting from CIDRs to IP ranges. 12 | -------------------------------------------------------------------------------- /cidr2range/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "cidr2range" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /cidr2range/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.2.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/cidr2range-${VSN}/cidr2range_${VSN}_${PLAT}.tar.gz 9 | tar -xf cidr2range_${VSN}_${PLAT}.tar.gz 10 | rm cidr2range_${VSN}_${PLAT}.tar.gz 11 | sudo mv cidr2range_${VSN}_${PLAT} /usr/local/bin/cidr2range 12 | 13 | echo 14 | echo 'You can now run `cidr2range`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /cidr2range/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "cidr2range" $VSN 13 | -------------------------------------------------------------------------------- /gif/README.md: -------------------------------------------------------------------------------- 1 | This folder contains all the metadata needed to produce the `.gif` files used 2 | in the root README. 3 | 4 | `Asciinema` is used to generate the `.cast` files. These `.cast` files are rendered into 5 | gifs with https://dstein64.github.io/gifcast/. 6 | -------------------------------------------------------------------------------- /gif/bulk.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/gif/bulk.gif -------------------------------------------------------------------------------- /gif/cat-csv.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/gif/cat-csv.gif -------------------------------------------------------------------------------- /gif/cat.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/gif/cat.gif -------------------------------------------------------------------------------- /gif/default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/gif/default.gif -------------------------------------------------------------------------------- /gif/hostname.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/gif/hostname.gif -------------------------------------------------------------------------------- /gif/ip8.8.8.8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/gif/ip8.8.8.8.gif -------------------------------------------------------------------------------- /gif/ips.txt: -------------------------------------------------------------------------------- 1 | 1.1.1.1 2 | 8.8.8.8 3 | 9.9.9.9 4 | 157.240.11.35 5 | 172.217.161.142 6 | 23.193.139.102 7 | 83.223.52.211 8 | 74.208.255.134 9 | 213.186.33.6 10 | 88.198.255.177 11 | 162.144.8.133 12 | -------------------------------------------------------------------------------- /gif/myip.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/gif/myip.gif -------------------------------------------------------------------------------- /gif/summarize.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/gif/summarize.gif -------------------------------------------------------------------------------- /grepdomain/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | - This new command `grepdomain` is similar to `grepip` but meant just for 4 | domain names. 5 | 6 | -------------------------------------------------------------------------------- /grepdomain/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /grepdomain 5 | COPY build/grepdomain ./ 6 | ENTRYPOINT ["/grepdomain/grepdomain"] 7 | -------------------------------------------------------------------------------- /grepdomain/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "grepdomain" $VSN 13 | -------------------------------------------------------------------------------- /grepdomain/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "grepdomain" 11 | -------------------------------------------------------------------------------- /grepdomain/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-o": predict.Nothing, 11 | "--only-matching": predict.Nothing, 12 | "-h": predict.Nothing, 13 | "--no-filename": predict.Nothing, 14 | "--no-recurse": predict.Nothing, 15 | "--version": predict.Nothing, 16 | "--help": predict.Nothing, 17 | "--nocolor": predict.Nothing, 18 | "--no-punycode": predict.Nothing, 19 | "-n": predict.Nothing, 20 | "--completions-install": predict.Nothing, 21 | "--completions-bash": predict.Nothing, 22 | "--completions-zsh": predict.Nothing, 23 | "--completions-fish": predict.Nothing, 24 | }, 25 | } 26 | 27 | func handleCompletions() { 28 | completions.Complete(progBase) 29 | } 30 | -------------------------------------------------------------------------------- /grepdomain/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.0.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/grepdomain-${VSN}/grepdomain_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i grepdomain_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i grepdomain_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm grepdomain_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `grepdomain`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /grepdomain/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: grepdomain 2 | Section: utils 3 | Version: 1.0.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: grepdomain 10 | Architecture: amd64 11 | Description: A grep-like tool for matching domain names. 12 | -------------------------------------------------------------------------------- /grepdomain/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "grepdomain" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /grepdomain/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.0.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/grepdomain-${VSN}/grepdomain_${VSN}_${PLAT}.tar.gz 9 | tar -xf grepdomain_${VSN}_${PLAT}.tar.gz 10 | rm grepdomain_${VSN}_${PLAT}.tar.gz 11 | sudo mv grepdomain_${VSN}_${PLAT} /usr/local/bin/grepdomain 12 | 13 | echo 14 | echo 'You can now run `grepdomain`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /grepdomain/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "grepdomain" $VSN 13 | -------------------------------------------------------------------------------- /grepip/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.2.3 2 | 3 | * Added new flags: `--include-cidrs`, `--include-ranges`, `--cidrs-only`, `--ranges-only` 4 | 5 | # 1.2.2 6 | 7 | * Some special bogon edge cases are now properly ignored by grepip when requested. 8 | -------------------------------------------------------------------------------- /grepip/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /grepip 5 | COPY build/grepip ./ 6 | ENTRYPOINT ["/grepip/grepip"] 7 | -------------------------------------------------------------------------------- /grepip/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "grepip" $VSN 13 | -------------------------------------------------------------------------------- /grepip/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "grepip" 11 | -------------------------------------------------------------------------------- /grepip/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.2.3 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/grepip-${VSN}/grepip_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i grepip_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i grepip_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm grepip_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `grepip`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /grepip/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: grepip 2 | Section: utils 3 | Version: 1.2.3 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: grepip 10 | Architecture: amd64 11 | Description: A grep-like tool for filtering IPv4 and IPv6 addresses. 12 | -------------------------------------------------------------------------------- /grepip/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "grepip" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /grepip/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.2.3 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/grepip-${VSN}/grepip_${VSN}_${PLAT}.tar.gz 9 | tar -xf grepip_${VSN}_${PLAT}.tar.gz 10 | rm grepip_${VSN}_${PLAT}.tar.gz 11 | sudo mv grepip_${VSN}_${PLAT} /usr/local/bin/grepip 12 | 13 | echo 14 | echo 'You can now run `grepip`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /grepip/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "grepip" $VSN 13 | -------------------------------------------------------------------------------- /ipinfo/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /ipinfo 5 | COPY build/ipinfo ./ 6 | ENTRYPOINT ["/ipinfo/ipinfo"] 7 | -------------------------------------------------------------------------------- /ipinfo/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | # Optional param LINUX_ONLY can be set to `true`, to build for linux only. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | LINUX_ONLY=$2 13 | 14 | $ROOT/scripts/build-all-platforms.sh "ipinfo" $VSN $LINUX_ONLY 15 | -------------------------------------------------------------------------------- /ipinfo/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "ipinfo" 11 | -------------------------------------------------------------------------------- /ipinfo/cmd_calc.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/ipinfo/cli/lib" 6 | "github.com/ipinfo/cli/lib/complete" 7 | "github.com/ipinfo/cli/lib/complete/predict" 8 | "github.com/spf13/pflag" 9 | ) 10 | 11 | var completionsCalc = &complete.Command{ 12 | Flags: map[string]complete.Predictor{ 13 | "-h": predict.Nothing, 14 | "--help": predict.Nothing, 15 | }, 16 | } 17 | 18 | // printHelpCalc prints the help message for the "calc" command. 19 | func printHelpCalc() { 20 | fmt.Printf( 21 | `Usage: %s calc [] 22 | 23 | Description: 24 | Evaluate a mathematical expression and print the result. 25 | 26 | Examples: 27 | %[1]s calc "2*2828-1" 28 | %[1]s calc "190.87.89.1*2" 29 | %[1]s calc "2001:0db8:85a3:0000:0000:8a2e:0370:7334*6" 30 | 31 | Options: 32 | General: 33 | --help, -h 34 | show help. 35 | `, progBase) 36 | } 37 | 38 | // cmdCalc is the handler for the "calc" command. 39 | func cmdCalc() error { 40 | f := lib.CmdCalcFlags{} 41 | f.Init() 42 | pflag.Parse() 43 | 44 | return lib.CmdCalc(f, pflag.Args()[1:], printHelpCalc) 45 | } 46 | -------------------------------------------------------------------------------- /ipinfo/cmd_cidr2ip.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib" 7 | "github.com/ipinfo/cli/lib/complete" 8 | "github.com/ipinfo/cli/lib/complete/predict" 9 | "github.com/spf13/pflag" 10 | ) 11 | 12 | var completionsCIDR2IP = &complete.Command{ 13 | Flags: map[string]complete.Predictor{ 14 | "-h": predict.Nothing, 15 | "--help": predict.Nothing, 16 | }, 17 | } 18 | 19 | func printHelpCIDR2IP() { 20 | fmt.Printf( 21 | `Usage: %s cidr2ip [] 22 | 23 | Description: 24 | Accepts CIDRs and file paths to files containing CIDRs, converting 25 | them all to individual IPs within those CIDRs. 26 | 27 | $ %[1]s cidr2ip 8.8.8.0/24 28 | 29 | Options: 30 | --help, -h 31 | show help. 32 | `, progBase) 33 | } 34 | 35 | func cmdCIDR2IP() error { 36 | f := lib.CmdCIDR2IPFlags{} 37 | f.Init() 38 | pflag.Parse() 39 | 40 | return lib.CmdCIDR2IP(f, pflag.Args()[1:], printHelpCIDR2IP) 41 | } 42 | -------------------------------------------------------------------------------- /ipinfo/cmd_logout.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib/complete" 7 | "github.com/ipinfo/cli/lib/complete/predict" 8 | "github.com/spf13/pflag" 9 | ) 10 | 11 | var completionsLogout = &complete.Command{ 12 | Flags: map[string]complete.Predictor{ 13 | "-h": predict.Nothing, 14 | "--help": predict.Nothing, 15 | }, 16 | } 17 | 18 | func printHelpLogout() { 19 | fmt.Printf( 20 | `Usage: %s logout [] 21 | 22 | Options: 23 | --help, -h 24 | show help. 25 | `, progBase) 26 | } 27 | 28 | func cmdLogout() error { 29 | pflag.BoolVarP(&fHelp, "help", "h", false, "show help.") 30 | pflag.Parse() 31 | 32 | if fHelp { 33 | printHelpLogout() 34 | return nil 35 | } 36 | 37 | // checks if not logged in. 38 | if gConfig.Token == "" { 39 | fmt.Println("not logged in") 40 | return nil 41 | } 42 | 43 | gConfig.Token = "" 44 | if err := SaveConfig(gConfig); err != nil { 45 | return err 46 | } 47 | 48 | fmt.Println("logged out") 49 | 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /ipinfo/cmd_mmdb_verify.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib/complete" 7 | "github.com/ipinfo/cli/lib/complete/predict" 8 | "github.com/ipinfo/mmdbctl/lib" 9 | "github.com/spf13/pflag" 10 | ) 11 | 12 | var completionsMmdbVerify = &complete.Command{ 13 | Flags: map[string]complete.Predictor{ 14 | "-h": predict.Nothing, 15 | "--help": predict.Nothing, 16 | }, 17 | } 18 | 19 | func printHelpMmdbVerify() { 20 | fmt.Printf( 21 | `Usage: %s mmdb verify [] 22 | 23 | Options: 24 | General: 25 | --help, -h 26 | show help. 27 | `, progBase) 28 | } 29 | 30 | func cmdMmdbVerify() error { 31 | f := lib.CmdVerifyFlags{} 32 | f.Init() 33 | pflag.Parse() 34 | if pflag.NArg() <= 2 && pflag.NFlag() == 0 { 35 | f.Help = true 36 | } 37 | 38 | return lib.CmdVerify(f, pflag.Args()[2:], printHelpMmdbVerify) 39 | } 40 | -------------------------------------------------------------------------------- /ipinfo/cmd_splitcidr.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib" 7 | "github.com/ipinfo/cli/lib/complete" 8 | "github.com/ipinfo/cli/lib/complete/predict" 9 | "github.com/spf13/pflag" 10 | ) 11 | 12 | var completionsSplitCIDR = &complete.Command{ 13 | Flags: map[string]complete.Predictor{ 14 | "-h": predict.Nothing, 15 | "--help": predict.Nothing, 16 | }, 17 | } 18 | 19 | func printHelpSplitCIDR() { 20 | fmt.Printf( 21 | `Usage: %s splitcidr 22 | 23 | Description: 24 | Splits a larger CIDR into smaller CIDRs. 25 | 26 | $ %[1]s splitcidr 8.8.8.0/24 25 27 | 28 | Options: 29 | --help, -h 30 | show help. 31 | `, progBase) 32 | } 33 | 34 | func cmdSplitCIDR() error { 35 | f := lib.CmdSplitCIDRFlags{} 36 | f.Init() 37 | pflag.Parse() 38 | 39 | return lib.CmdSplitCIDR(f, pflag.Args()[1:], printHelpSplitCIDR) 40 | } 41 | -------------------------------------------------------------------------------- /ipinfo/cmd_version.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib/complete" 7 | ) 8 | 9 | var completionsVersion = &complete.Command{} 10 | 11 | func cmdVersion() error { 12 | fmt.Println(version) 13 | return nil 14 | } 15 | -------------------------------------------------------------------------------- /ipinfo/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=3.3.1 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | 25 | curl -LO https://github.com/ipinfo/cli/releases/download/ipinfo-${VSN}/ipinfo_${VSN}_linux_${ARCH_NAME}.deb 26 | if command -v sudo >/dev/null 2>&1; then 27 | sudo dpkg -i ipinfo_${VSN}_linux_${ARCH_NAME}.deb 28 | else 29 | dpkg -i ipinfo_${VSN}_linux_${ARCH_NAME}.deb 30 | fi 31 | rm ipinfo_${VSN}_linux_${ARCH_NAME}.deb 32 | 33 | echo 34 | echo 'You can now run `ipinfo`'. 35 | 36 | if [ -f "$0" ]; then 37 | rm $0 38 | fi 39 | -------------------------------------------------------------------------------- /ipinfo/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: ipinfo 2 | Section: utils 3 | Version: 3.3.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: ipinfo 10 | Architecture: amd64 11 | Description: This is the official CLI for the IPinfo IP Address API. 12 | -------------------------------------------------------------------------------- /ipinfo/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "ipinfo" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /ipinfo/init.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func init() { 6 | if err := InitConfig(); err != nil { 7 | fmt.Println("warn: error in creating config file.") 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ipinfo/ipinfo_client.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | 7 | "github.com/ipinfo/go/v2/ipinfo" 8 | ) 9 | 10 | var ii *ipinfo.Client 11 | 12 | func prepareIpinfoClient(tok string) *ipinfo.Client { 13 | var _ii *ipinfo.Client 14 | 15 | // get token from persistent store. 16 | if tok == "" { 17 | tok = gConfig.Token 18 | } 19 | 20 | var cache *ipinfo.Cache 21 | if gConfig.CacheEnabled && !fNoCache { 22 | boltdbCache, err := NewBoltdbCache() 23 | if err != nil { 24 | fmt.Printf("warn: cache will not be used: %v", err) 25 | } else { 26 | cache = ipinfo.NewCache(boltdbCache) 27 | } 28 | } 29 | 30 | // init client. 31 | _ii = ipinfo.NewClient(nil, cache, tok) 32 | _ii.UserAgent = fmt.Sprintf( 33 | "IPinfoCli/%s (os/%s - arch/%s)", 34 | version, runtime.GOOS, runtime.GOARCH, 35 | ) 36 | return _ii 37 | } 38 | -------------------------------------------------------------------------------- /ipinfo/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=3.3.1 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/ipinfo-${VSN}/ipinfo_${VSN}_${PLAT}.tar.gz 9 | tar -xf ipinfo_${VSN}_${PLAT}.tar.gz 10 | rm ipinfo_${VSN}_${PLAT}.tar.gz 11 | sudo mv ipinfo_${VSN}_${PLAT} /usr/local/bin/ipinfo 12 | 13 | echo 14 | echo 'You can now run `ipinfo`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /ipinfo/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "ipinfo" $VSN 13 | -------------------------------------------------------------------------------- /lib/cmd_cidr2ip.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/ipinfo/cli/lib/iputil" 7 | "github.com/spf13/pflag" 8 | ) 9 | 10 | // CmdCIDR2IPFlags are flags expected by CmdCIDR2IP. 11 | type CmdCIDR2IPFlags struct { 12 | Help bool 13 | } 14 | 15 | // Init initializes the common flags available to CmdCIDR2IP with sensible 16 | // defaults. 17 | // 18 | // pflag.Parse() must be called to actually use the final flag values. 19 | func (f *CmdCIDR2IPFlags) Init() { 20 | pflag.BoolVarP( 21 | &f.Help, 22 | "help", "h", false, 23 | "show help.", 24 | ) 25 | } 26 | 27 | func CmdCIDR2IP(f CmdCIDR2IPFlags, args []string, printHelp func()) error { 28 | if f.Help { 29 | printHelp() 30 | return nil 31 | } 32 | 33 | // require args and/or stdin. 34 | stat, _ := os.Stdin.Stat() 35 | isStdin := (stat.Mode() & os.ModeCharDevice) == 0 36 | if len(args) == 0 && !isStdin { 37 | printHelp() 38 | return nil 39 | } 40 | 41 | return iputil.IPListWriteFrom(args, true, false, false, true, true) 42 | } 43 | -------------------------------------------------------------------------------- /lib/cmd_prips.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/ipinfo/cli/lib/iputil" 7 | "github.com/spf13/pflag" 8 | ) 9 | 10 | // CmdPripsFlags are flags expected by CmdPrips. 11 | type CmdPripsFlags struct { 12 | Help bool 13 | } 14 | 15 | // Init initializes the common flags available to CmdPrips with sensible 16 | // defaults. 17 | // 18 | // pflag.Parse() must be called to actually use the final flag values. 19 | func (f *CmdPripsFlags) Init() { 20 | pflag.BoolVarP( 21 | &f.Help, 22 | "help", "h", false, 23 | "show help.", 24 | ) 25 | } 26 | 27 | // CmdPrips is the common core logic for the prips command. 28 | func CmdPrips( 29 | f CmdPripsFlags, 30 | args []string, 31 | printHelp func(), 32 | ) error { 33 | if f.Help { 34 | printHelp() 35 | return nil 36 | } 37 | 38 | // require args and/or stdin. 39 | stat, _ := os.Stdin.Stat() 40 | isStdin := (stat.Mode() & os.ModeCharDevice) == 0 41 | if len(args) == 0 && !isStdin { 42 | printHelp() 43 | return nil 44 | } 45 | 46 | return iputil.IPListWriteFromAllSrcs(args) 47 | } 48 | -------------------------------------------------------------------------------- /lib/cmd_range2ip.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/ipinfo/cli/lib/iputil" 7 | "github.com/spf13/pflag" 8 | ) 9 | 10 | // CmdRange2IPFlags are flags expected by CmdRange2IP. 11 | type CmdRange2IPFlags struct { 12 | Help bool 13 | } 14 | 15 | // Init initializes the common flags available to CmdRange2IP with sensible 16 | // defaults. 17 | // 18 | // pflag.Parse() must be called to actually use the final flag values. 19 | func (f *CmdRange2IPFlags) Init() { 20 | pflag.BoolVarP( 21 | &f.Help, 22 | "help", "h", false, 23 | "show help.", 24 | ) 25 | } 26 | 27 | func CmdRange2IP(f CmdRange2IPFlags, args []string, printHelp func()) error { 28 | if f.Help { 29 | printHelp() 30 | return nil 31 | } 32 | 33 | // require args and/or stdin. 34 | stat, _ := os.Stdin.Stat() 35 | isStdin := (stat.Mode() & os.ModeCharDevice) == 0 36 | if len(args) == 0 && !isStdin { 37 | printHelp() 38 | return nil 39 | } 40 | 41 | return iputil.IPListWriteFrom(args, true, true, true, false, true) 42 | } 43 | -------------------------------------------------------------------------------- /lib/cmd_tool_ip2n.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib/iputil" 7 | "github.com/spf13/pflag" 8 | ) 9 | 10 | // CmdToolIP2nFlags are flags expected by CmdToolIP2n 11 | type CmdToolIP2nFlags struct { 12 | Help bool 13 | } 14 | 15 | // Init initializes the common flags available to CmdToolIP2n with sensible 16 | func (f *CmdToolIP2nFlags) Init() { 17 | pflag.BoolVarP( 18 | &f.Help, 19 | "help", "h", false, 20 | "show help.", 21 | ) 22 | } 23 | 24 | // CmdToolIP2n converts an IP address to a number 25 | func CmdToolIP2n(f CmdToolIP2nFlags, args []string, printHelp func()) error { 26 | if len(args) == 0 || f.Help { 27 | printHelp() 28 | return nil 29 | } 30 | 31 | ipString := args[0] 32 | res, err := iputil.IPtoDecimalStr(ipString) 33 | if err != nil { 34 | return err 35 | } 36 | 37 | fmt.Println(res) 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /lib/cmd_tool_next.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib/iputil" 7 | "github.com/spf13/pflag" 8 | ) 9 | 10 | type CmdToolNextFlags struct { 11 | Help bool 12 | Quiet bool 13 | } 14 | 15 | func (f *CmdToolNextFlags) Init() { 16 | pflag.BoolVarP( 17 | &f.Help, 18 | "help", "h", false, 19 | "show help.", 20 | ) 21 | pflag.BoolVarP( 22 | &f.Quiet, 23 | "quiet", "q", false, 24 | "quiet mode; suppress additional output.", 25 | ) 26 | } 27 | 28 | func CmdToolNext( 29 | f CmdToolNextFlags, 30 | args []string, 31 | printHelp func(), 32 | ) error { 33 | if f.Help { 34 | printHelp() 35 | return nil 36 | } 37 | 38 | actionFunc := func(input string, inputType iputil.INPUT_TYPE) error { 39 | switch inputType { 40 | case iputil.INPUT_TYPE_IP: 41 | newIP := iputil.IpAdd(input, 1) 42 | fmt.Println(newIP) 43 | } 44 | return nil 45 | } 46 | err := iputil.GetInputFrom(args, true, true, actionFunc) 47 | if err != nil { 48 | fmt.Println(err) 49 | } 50 | 51 | return nil 52 | } 53 | -------------------------------------------------------------------------------- /lib/cmd_tool_prefix_addr.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | "net/netip" 6 | 7 | "github.com/ipinfo/cli/lib/iputil" 8 | "github.com/spf13/pflag" 9 | ) 10 | 11 | type CmdToolPrefixAddrFlags struct { 12 | Help bool 13 | } 14 | 15 | func (f *CmdToolPrefixAddrFlags) Init() { 16 | pflag.BoolVarP( 17 | &f.Help, 18 | "help", "h", false, 19 | "show help.", 20 | ) 21 | } 22 | 23 | func CmdToolPrefixAddr(f CmdToolPrefixAddrFlags, args []string, printHelp func()) error { 24 | if f.Help { 25 | printHelp() 26 | return nil 27 | } 28 | 29 | op := func(input string, inputType iputil.INPUT_TYPE) error { 30 | switch inputType { 31 | case iputil.INPUT_TYPE_CIDR: 32 | prefix, err := netip.ParsePrefix(input) 33 | if err != nil { 34 | return err 35 | } 36 | fmt.Printf("%s,%s\n", input, prefix.Addr()) 37 | } 38 | return nil 39 | } 40 | 41 | return iputil.GetInputFrom(args, true, true, op) 42 | } 43 | -------------------------------------------------------------------------------- /lib/cmd_tool_prefix_bits.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | "net/netip" 6 | 7 | "github.com/ipinfo/cli/lib/iputil" 8 | "github.com/spf13/pflag" 9 | ) 10 | 11 | type CmdToolPrefixBitsFlags struct { 12 | Help bool 13 | } 14 | 15 | func (f *CmdToolPrefixBitsFlags) Init() { 16 | pflag.BoolVarP( 17 | &f.Help, 18 | "help", "h", false, 19 | "show help.", 20 | ) 21 | } 22 | 23 | func CmdToolPrefixBits(f CmdToolPrefixBitsFlags, args []string, printHelp func()) error { 24 | if f.Help { 25 | printHelp() 26 | return nil 27 | } 28 | 29 | op := func(input string, inputType iputil.INPUT_TYPE) error { 30 | switch inputType { 31 | case iputil.INPUT_TYPE_CIDR: 32 | prefix, err := netip.ParsePrefix(input) 33 | if err != nil { 34 | return err 35 | } 36 | fmt.Printf("%s,%d\n", input, prefix.Bits()) 37 | } 38 | return nil 39 | } 40 | 41 | return iputil.GetInputFrom(args, true, true, op) 42 | } 43 | -------------------------------------------------------------------------------- /lib/cmd_tool_prefix_masked.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | "net/netip" 6 | 7 | "github.com/ipinfo/cli/lib/iputil" 8 | "github.com/spf13/pflag" 9 | ) 10 | 11 | type CmdToolPrefixMaskedFlags struct { 12 | Help bool 13 | } 14 | 15 | func (f *CmdToolPrefixMaskedFlags) Init() { 16 | pflag.BoolVarP( 17 | &f.Help, 18 | "help", "h", false, 19 | "show help.", 20 | ) 21 | } 22 | 23 | func CmdToolPrefixMasked(f CmdToolPrefixMaskedFlags, args []string, printHelp func()) error { 24 | if f.Help { 25 | printHelp() 26 | return nil 27 | } 28 | 29 | op := func(input string, inputType iputil.INPUT_TYPE) error { 30 | switch inputType { 31 | case iputil.INPUT_TYPE_CIDR: 32 | prefix, err := netip.ParsePrefix(input) 33 | if err != nil { 34 | return err 35 | } 36 | fmt.Printf("%s,%s\n", input, prefix.Masked()) 37 | } 38 | return nil 39 | } 40 | 41 | return iputil.GetInputFrom(args, true, true, op) 42 | } 43 | -------------------------------------------------------------------------------- /lib/cmd_tool_prefix_valid.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | "net/netip" 6 | 7 | "github.com/ipinfo/cli/lib/iputil" 8 | "github.com/spf13/pflag" 9 | ) 10 | 11 | type CmdToolPrefixIsValidFlags struct { 12 | Help bool 13 | } 14 | 15 | func (f *CmdToolPrefixIsValidFlags) Init() { 16 | pflag.BoolVarP( 17 | &f.Help, 18 | "help", "h", false, 19 | "show help.", 20 | ) 21 | } 22 | 23 | func CmdToolPrefixIsValid(f CmdToolPrefixIsValidFlags, args []string, printHelp func()) error { 24 | if f.Help { 25 | printHelp() 26 | return nil 27 | } 28 | 29 | op := func(input string, inputType iputil.INPUT_TYPE) error { 30 | switch inputType { 31 | case iputil.INPUT_TYPE_CIDR: 32 | prefix, err := netip.ParsePrefix(input) 33 | if err != nil { 34 | return err 35 | } 36 | fmt.Printf("%s,%t\n", input, prefix.IsValid()) 37 | } 38 | return nil 39 | } 40 | 41 | return iputil.GetInputFrom(args, true, true, op) 42 | } 43 | -------------------------------------------------------------------------------- /lib/cmd_tool_prev.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib/iputil" 7 | "github.com/spf13/pflag" 8 | ) 9 | 10 | type CmdToolPrevFlags struct { 11 | Help bool 12 | Quiet bool 13 | } 14 | 15 | func (f *CmdToolPrevFlags) Init() { 16 | pflag.BoolVarP( 17 | &f.Help, 18 | "help", "h", false, 19 | "show help.", 20 | ) 21 | pflag.BoolVarP( 22 | &f.Quiet, 23 | "quiet", "q", false, 24 | "quiet mode; suppress additional output.", 25 | ) 26 | } 27 | 28 | func CmdToolPrev( 29 | f CmdToolPrevFlags, 30 | args []string, 31 | printHelp func(), 32 | ) error { 33 | if f.Help { 34 | printHelp() 35 | return nil 36 | } 37 | 38 | actionFunc := func(input string, inputType iputil.INPUT_TYPE) error { 39 | switch inputType { 40 | case iputil.INPUT_TYPE_IP: 41 | newIP := iputil.IpAdd(input, -1) 42 | fmt.Println(newIP) 43 | } 44 | return nil 45 | } 46 | err := iputil.GetInputFrom(args, true, true, actionFunc) 47 | if err != nil { 48 | fmt.Println(err) 49 | } 50 | 51 | return nil 52 | } 53 | -------------------------------------------------------------------------------- /lib/cmd_tool_unmap.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | "net/netip" 6 | 7 | "github.com/ipinfo/cli/lib/iputil" 8 | "github.com/spf13/pflag" 9 | ) 10 | 11 | // CmdToolUnmapFlags are flags expected by CmdToolUnmap 12 | type CmdToolUnmapFlags struct { 13 | Help bool 14 | } 15 | 16 | // Init initializes the common flags available to CmdToolUnmap with sensible 17 | func (f *CmdToolUnmapFlags) Init() { 18 | pflag.BoolVarP( 19 | &f.Help, 20 | "help", "h", false, 21 | "show help.", 22 | ) 23 | } 24 | 25 | // CmdToolUnmap converts a number to an IP address 26 | func CmdToolUnmap(f CmdToolUnmapFlags, args []string, printHelp func()) error { 27 | if f.Help { 28 | printHelp() 29 | return nil 30 | } 31 | 32 | op := func(input string, input_type iputil.INPUT_TYPE) error { 33 | switch input_type { 34 | case iputil.INPUT_TYPE_IP: 35 | addr, err := netip.ParseAddr(input) 36 | if err != nil { 37 | return err 38 | } 39 | fmt.Println(addr.Unmap()) 40 | } 41 | return nil 42 | } 43 | 44 | return iputil.GetInputFrom(args, true, true, op) 45 | } 46 | -------------------------------------------------------------------------------- /lib/cmd_tool_valid.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/cli/lib/iputil" 7 | "github.com/spf13/pflag" 8 | ) 9 | 10 | // CmdToolIsValidFlags are flags expected by CmdToolIsValid 11 | type CmdToolIsValidFlags struct { 12 | Help bool 13 | ipv6 bool 14 | } 15 | 16 | // Init initializes the common flags available to CmdToolIsValid with sensible 17 | func (f *CmdToolIsValidFlags) Init() { 18 | pflag.BoolVarP( 19 | &f.Help, 20 | "help", "h", false, 21 | "show help.", 22 | ) 23 | } 24 | 25 | // CmdToolIsValid converts a number to an IP address 26 | func CmdToolIsValid(f CmdToolIsValidFlags, args []string, printHelp func()) error { 27 | if f.Help { 28 | printHelp() 29 | return nil 30 | } 31 | 32 | op := func(input string, input_type iputil.INPUT_TYPE) error { 33 | switch input_type { 34 | case iputil.INPUT_TYPE_IP: 35 | fmt.Printf("%s,%v\n", input, true) 36 | default: 37 | fmt.Printf("%s,%v\n", input, false) 38 | } 39 | return nil 40 | } 41 | 42 | return iputil.GetInputFrom(args, true, true, op) 43 | } 44 | -------------------------------------------------------------------------------- /lib/complete/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | coverage.txt 3 | example/self/self 4 | -------------------------------------------------------------------------------- /lib/complete/predict/options_test.go: -------------------------------------------------------------------------------- 1 | package predict 2 | 3 | import "testing" 4 | 5 | import "github.com/stretchr/testify/assert" 6 | 7 | func TestConfigCheck(t *testing.T) { 8 | t.Parallel() 9 | 10 | t.Run("enabled", func(t *testing.T) { 11 | cfg := Options(OptValues("foo", "bar", "foo-bar"), OptCheck()) 12 | assert.NoError(t, cfg.Check("foo")) 13 | assert.NoError(t, cfg.Check("bar")) 14 | assert.NoError(t, cfg.Check("foo-bar")) 15 | assert.Error(t, cfg.Check("fo")) 16 | assert.Error(t, cfg.Check("baz")) 17 | }) 18 | 19 | t.Run("disabled", func(t *testing.T) { 20 | cfg := Options(OptValues("foo", "bar", "foo-bar")) 21 | assert.NoError(t, cfg.Check("foo")) 22 | assert.NoError(t, cfg.Check("fo")) 23 | assert.NoError(t, cfg.Check("baz")) 24 | }) 25 | } 26 | 27 | func TestConfigPredict(t *testing.T) { 28 | t.Parallel() 29 | 30 | t.Run("set", func(t *testing.T) { 31 | cfg := Options(OptValues("foo", "bar", "foo-bar")) 32 | assert.Equal(t, []string{"foo", "bar", "foo-bar"}, cfg.Predict("")) 33 | }) 34 | 35 | t.Run("not set", func(t *testing.T) { 36 | cfg := Options() 37 | assert.Nil(t, cfg.Predict("")) 38 | }) 39 | } 40 | -------------------------------------------------------------------------------- /lib/complete/predict/predict.go: -------------------------------------------------------------------------------- 1 | // Package predict provides helper functions for completion predictors. 2 | package predict 3 | 4 | import "github.com/ipinfo/cli/lib/complete" 5 | 6 | // Set predicts a set of predefined values. 7 | type Set []string 8 | 9 | func (p Set) Predict(_ string) (options []string) { 10 | return p 11 | } 12 | 13 | var ( 14 | // Something is used to indicate that does not completes somthing. Such that other prediction 15 | // wont be applied. 16 | Something = Set{""} 17 | 18 | // Nothing is used to indicate that does not completes anything. 19 | Nothing = Set{} 20 | ) 21 | 22 | // Or unions prediction functions, so that the result predication is the union of their 23 | // predications. 24 | func Or(ps ...complete.Predictor) complete.Predictor { 25 | return complete.PredictFunc(func(prefix string) (options []string) { 26 | for _, p := range ps { 27 | if p == nil { 28 | continue 29 | } 30 | options = append(options, p.Predict(prefix)...) 31 | } 32 | return 33 | }) 34 | } 35 | -------------------------------------------------------------------------------- /lib/complete/predict/testdata/.dot.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/lib/complete/predict/testdata/.dot.txt -------------------------------------------------------------------------------- /lib/complete/predict/testdata/a.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/lib/complete/predict/testdata/a.txt -------------------------------------------------------------------------------- /lib/complete/predict/testdata/b.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/lib/complete/predict/testdata/b.txt -------------------------------------------------------------------------------- /lib/complete/predict/testdata/c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/lib/complete/predict/testdata/c.txt -------------------------------------------------------------------------------- /lib/complete/predict/testdata/dir/bar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/lib/complete/predict/testdata/dir/bar -------------------------------------------------------------------------------- /lib/complete/predict/testdata/dir/foo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/lib/complete/predict/testdata/dir/foo -------------------------------------------------------------------------------- /lib/complete/predict/testdata/outer/inner/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipinfo/cli/a9ca4b1d939d42ef2343696283ddc6382771d3c4/lib/complete/predict/testdata/outer/inner/readme.md -------------------------------------------------------------------------------- /lib/complete/predict/testdata/readme.md: -------------------------------------------------------------------------------- 1 | # About this directory 2 | 3 | This directory is for testing file completion purposes -------------------------------------------------------------------------------- /lib/complete/testing.go: -------------------------------------------------------------------------------- 1 | package complete 2 | 3 | import ( 4 | "sort" 5 | "testing" 6 | ) 7 | 8 | // Test is a testing helper function for testing bash completion of a given 9 | // completer. 10 | func Test(t *testing.T, cmp Completer, args string, want []string) { 11 | t.Helper() 12 | got, err := completer{Completer: cmp, args: Parse(args)}.complete() 13 | if err != nil { 14 | t.Fatal(err) 15 | } 16 | sort.Strings(got) 17 | sort.Strings(want) 18 | if len(want) != len(got) { 19 | t.Errorf("got != want: want = %+v, got = %+v", want, got) 20 | return 21 | } 22 | for i := range want { 23 | if want[i] != got[i] { 24 | t.Errorf("got != want: want = %+v, got = %+v", want, got) 25 | return 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/domain.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import "regexp" 4 | 5 | var DomainRegex = regexp.MustCompile(`(?:[a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}|(?:[^\s.]+\.)+[^\s]{2,}`) 6 | -------------------------------------------------------------------------------- /lib/help_detailed.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "os/exec" 7 | "strings" 8 | ) 9 | 10 | func HelpDetailed(detailedHelp string, printHelpDefault func()) error { 11 | pagerCmd := os.Getenv("PAGER") 12 | if pagerCmd == "" { 13 | // If PAGER is not set, use a default pager (e.g., less) 14 | pagerCmd = "less" 15 | } 16 | 17 | cmd := exec.Command(pagerCmd) 18 | reader := io.Reader(strings.NewReader(detailedHelp)) 19 | cmd.Stdin = reader 20 | cmd.Stdout = os.Stdout 21 | cmd.Stderr = os.Stderr 22 | 23 | // If an error occurs running the pager, display the default help 24 | if err := cmd.Run(); err != nil { 25 | printHelpDefault() 26 | } 27 | 28 | return nil 29 | } 30 | -------------------------------------------------------------------------------- /lib/iputil/asn_str.go: -------------------------------------------------------------------------------- 1 | package iputil 2 | 3 | import ( 4 | "strconv" 5 | "strings" 6 | ) 7 | 8 | // StrIsASNStr checks whether an ASN string really is an ASN of the form 9 | // "asX" or "ASX" where "X" is the ASN's number. 10 | func StrIsASNStr(asn string) bool { 11 | // check length. 12 | if len(asn) < 3 { 13 | return false 14 | } 15 | 16 | // ensure "AS" or "as" prefix. 17 | if !strings.HasPrefix(asn, "AS") && !strings.HasPrefix(asn, "as") { 18 | return false 19 | } 20 | 21 | // ensure number suffix. 22 | asnNumStr := asn[2:] 23 | if _, err := strconv.Atoi(asnNumStr); err != nil { 24 | return false 25 | } 26 | 27 | return true 28 | } 29 | -------------------------------------------------------------------------------- /lib/iputil/file.go: -------------------------------------------------------------------------------- 1 | package iputil 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | // FileExists checks if a file exists. 8 | func FileExists(pathToFile string) bool { 9 | if _, err := os.Stat(pathToFile); os.IsNotExist(err) { 10 | return false 11 | } 12 | return true 13 | } 14 | -------------------------------------------------------------------------------- /lib/iputil/ip6_str.go: -------------------------------------------------------------------------------- 1 | package iputil 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | // StrIsIP6Str checks whether a string is an IPv6. 8 | func StrIsIP6Str(ipStr string) bool { 9 | ip := net.ParseIP(ipStr) 10 | return ip != nil && len(ip) == net.IPv6len 11 | } 12 | -------------------------------------------------------------------------------- /lib/iputil/ip6_subnet_str.go: -------------------------------------------------------------------------------- 1 | package iputil 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | /* 8 | Note that we always represent subnets as CIDRs, hence the filename having to do 9 | with subnets but the functions using "CIDR" in their names. 10 | */ 11 | 12 | // StrIsCIDR6Str checks whether a string is in proper CIDR IPv6 form. 13 | func StrIsCIDR6Str(cidrStr string) bool { 14 | ip, _, err := net.ParseCIDR(cidrStr) 15 | return err == nil && ip != nil && len(ip) == net.IPv6len 16 | } 17 | -------------------------------------------------------------------------------- /lib/iputil/ip_str.go: -------------------------------------------------------------------------------- 1 | package iputil 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | // StrIsIPStr checks whether a string is an IP. 8 | func StrIsIPStr(ipStr string) bool { 9 | return net.ParseIP(ipStr) != nil 10 | } 11 | 12 | // StrIsIPv4Str checks if the given string is an IPv4 address 13 | func StrIsIPv4Str(expression string) bool { 14 | return IpV4Regex.MatchString(expression) 15 | } 16 | 17 | // StrIsIPv6Str checks if the given string is an IPv6 address 18 | func StrIsIPv6Str(expression string) bool { 19 | return IpV6Regex.MatchString(expression) 20 | } 21 | -------------------------------------------------------------------------------- /lib/iputil/ip_subnet_str.go: -------------------------------------------------------------------------------- 1 | package iputil 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | /* 8 | Note that we always represent subnets as CIDRs, hence the filename having to do 9 | with subnets but the functions using "CIDR" in their names. 10 | */ 11 | 12 | // StrIsCIDRStr checks whether a string is in proper CIDR form. 13 | func StrIsCIDRStr(cidrStr string) bool { 14 | _, _, err := net.ParseCIDR(cidrStr) 15 | return err == nil 16 | } 17 | -------------------------------------------------------------------------------- /lib/iputil/string_slice.go: -------------------------------------------------------------------------------- 1 | package iputil 2 | 3 | // StringSliceRev reverses the order of elements inside of a string slice. 4 | func StringSliceRev(s []string) { 5 | last := len(s) - 1 6 | for i := 0; i < len(s)/2; i++ { 7 | s[i], s[last-i] = s[last-i], s[i] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /matchip/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | * `matchip` is a command for printing the IPs and subnets that fall under the given list of subnets. 4 | * The command exists as a standalone binary in addition to as a subcommand on the main `ipinfo` command. 5 | * `matchip` accepts inputs the same way our other commands do, via stdin, args, files, etc. 6 | -------------------------------------------------------------------------------- /matchip/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /matchip 5 | COPY build/matchip ./ 6 | ENTRYPOINT ["/matchip/matchip"] 7 | -------------------------------------------------------------------------------- /matchip/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "matchip" $VSN 13 | -------------------------------------------------------------------------------- /matchip/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "matchip" 11 | -------------------------------------------------------------------------------- /matchip/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-e": predict.Nothing, 11 | "--expression": predict.Nothing, 12 | "--help": predict.Nothing, 13 | }, 14 | } 15 | 16 | func handleCompletions() { 17 | completions.Complete(progBase) 18 | } 19 | -------------------------------------------------------------------------------- /matchip/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.0.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/matchip-${VSN}/matchip_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i matchip_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i matchip_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm matchip_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `matchip`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /matchip/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: matchip 2 | Section: utils 3 | Version: 1.0.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: matchip 10 | Architecture: amd64 11 | Description: A tool for finding overlapping IPs and subnets. 12 | -------------------------------------------------------------------------------- /matchip/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "matchip" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /matchip/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.0.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/matchip-${VSN}/matchip_${VSN}_${PLAT}.tar.gz 9 | tar -xf matchip_${VSN}_${PLAT}.tar.gz 10 | rm matchip_${VSN}_${PLAT}.tar.gz 11 | sudo mv matchip_${VSN}_${PLAT} /usr/local/bin/matchip 12 | 13 | echo 14 | echo 'You can now run `matchip`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /matchip/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "matchip" $VSN 13 | -------------------------------------------------------------------------------- /prips/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | * `prips` is a command for printing all the IPs that exist within a CIDR and/or 4 | IP range; it is effectively a combination of `range2ip` and `cidr2ip` in one. 5 | * The command exists as a standalone binary in addition to as a subcommand on the 6 | main `ipinfo` command. 7 | * `prips` accepts inputs the same way our other commands do, via stdin, args, 8 | files, etc. 9 | -------------------------------------------------------------------------------- /prips/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /prips 5 | COPY build/prips ./ 6 | ENTRYPOINT ["/prips/prips"] 7 | -------------------------------------------------------------------------------- /prips/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "prips" $VSN 13 | -------------------------------------------------------------------------------- /prips/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "prips" 11 | -------------------------------------------------------------------------------- /prips/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-v": predict.Nothing, 11 | "--version": predict.Nothing, 12 | "-h": predict.Nothing, 13 | "--help": predict.Nothing, 14 | "--completions-install": predict.Nothing, 15 | "--completions-bash": predict.Nothing, 16 | "--completions-zsh": predict.Nothing, 17 | "--completions-fish": predict.Nothing, 18 | }, 19 | } 20 | 21 | func handleCompletions() { 22 | completions.Complete(progBase) 23 | } 24 | -------------------------------------------------------------------------------- /prips/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.0.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/prips-${VSN}/prips_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i prips_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i prips_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm prips_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `prips`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /prips/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: prips 2 | Section: utils 3 | Version: 1.0.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: prips 10 | Architecture: amd64 11 | Description: A tool for printing IPs. 12 | -------------------------------------------------------------------------------- /prips/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "prips" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /prips/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.0.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/prips-${VSN}/prips_${VSN}_${PLAT}.tar.gz 9 | tar -xf prips_${VSN}_${PLAT}.tar.gz 10 | rm prips_${VSN}_${PLAT}.tar.gz 11 | sudo mv prips_${VSN}_${PLAT} /usr/local/bin/prips 12 | 13 | echo 14 | echo 'You can now run `prips`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /prips/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "prips" $VSN 13 | -------------------------------------------------------------------------------- /randip/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.1.0 2 | 3 | * `randip now supports` allowing generation of only unique IPs via the `--unique` 4 | or `-u` flags. 5 | * Additionally, a bug was fixed where the ending IP of a range of size greater 6 | than 1 was never selected. 7 | -------------------------------------------------------------------------------- /randip/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /randip 5 | COPY build/randip ./ 6 | ENTRYPOINT ["/randip/randip"] 7 | -------------------------------------------------------------------------------- /randip/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "randip" $VSN 13 | -------------------------------------------------------------------------------- /randip/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "randip" 11 | -------------------------------------------------------------------------------- /randip/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-v": predict.Nothing, 11 | "--version": predict.Nothing, 12 | "-h": predict.Nothing, 13 | "--help": predict.Nothing, 14 | "--completions-install": predict.Nothing, 15 | "--completions-bash": predict.Nothing, 16 | "--completions-zsh": predict.Nothing, 17 | "--completions-fish": predict.Nothing, 18 | }, 19 | } 20 | 21 | func handleCompletions() { 22 | completions.Complete(progBase) 23 | } 24 | -------------------------------------------------------------------------------- /randip/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.1.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/randip-${VSN}/randip_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i randip_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i randip_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm randip_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `randip`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /randip/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: randip 2 | Section: utils 3 | Version: 1.1.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: randip 10 | Architecture: amd64 11 | Description: A tool for generating random IPs. 12 | -------------------------------------------------------------------------------- /randip/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "randip" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /randip/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.1.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/randip-${VSN}/randip_${VSN}_${PLAT}.tar.gz 9 | tar -xf randip_${VSN}_${PLAT}.tar.gz 10 | rm randip_${VSN}_${PLAT}.tar.gz 11 | sudo mv randip_${VSN}_${PLAT} /usr/local/bin/randip 12 | 13 | echo 14 | echo 'You can now run `randip`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /randip/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "randip" $VSN 13 | -------------------------------------------------------------------------------- /range2cidr/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.3.0 2 | 3 | * Fixed range2cidr not properly re-writing headers when they were available. 4 | -------------------------------------------------------------------------------- /range2cidr/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /range2cidr 5 | COPY build/range2cidr ./ 6 | ENTRYPOINT ["/range2cidr/range2cidr"] 7 | -------------------------------------------------------------------------------- /range2cidr/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "range2cidr" $VSN 13 | -------------------------------------------------------------------------------- /range2cidr/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "range2cidr" 11 | -------------------------------------------------------------------------------- /range2cidr/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-v": predict.Nothing, 11 | "--version": predict.Nothing, 12 | "-h": predict.Nothing, 13 | "--help": predict.Nothing, 14 | "--completions-install": predict.Nothing, 15 | "--completions-bash": predict.Nothing, 16 | "--completions-zsh": predict.Nothing, 17 | "--completions-fish": predict.Nothing, 18 | }, 19 | } 20 | 21 | func handleCompletions() { 22 | completions.Complete(progBase) 23 | } 24 | -------------------------------------------------------------------------------- /range2cidr/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.3.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/range2cidr-${VSN}/range2cidr_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i range2cidr_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i range2cidr_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm range2cidr_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `range2cidr`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /range2cidr/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: range2cidr 2 | Section: utils 3 | Version: 1.3.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: range2cidr 10 | Architecture: amd64 11 | Description: A simple tool for converting from IP ranges to CIDRs. 12 | -------------------------------------------------------------------------------- /range2cidr/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "range2cidr" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /range2cidr/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.3.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/range2cidr-${VSN}/range2cidr_${VSN}_${PLAT}.tar.gz 9 | tar -xf range2cidr_${VSN}_${PLAT}.tar.gz 10 | rm range2cidr_${VSN}_${PLAT}.tar.gz 11 | sudo mv range2cidr_${VSN}_${PLAT} /usr/local/bin/range2cidr 12 | 13 | echo 14 | echo 'You can now run `range2cidr`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /range2cidr/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "range2cidr" $VSN 13 | -------------------------------------------------------------------------------- /range2ip/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | * `range2ip` converts IP ranges to individual IPs within those ranges. 4 | * The command exists as a standalone binary in addition to as a subcommand on the 5 | main `ipinfo` command. 6 | * `range2ip` accepts inputs the same way our other commands do, via stdin, args, 7 | files, etc. 8 | -------------------------------------------------------------------------------- /range2ip/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /range2ip 5 | COPY build/range2ip ./ 6 | ENTRYPOINT ["/range2ip/range2ip"] 7 | -------------------------------------------------------------------------------- /range2ip/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "range2ip" $VSN 13 | -------------------------------------------------------------------------------- /range2ip/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "range2ip" 11 | -------------------------------------------------------------------------------- /range2ip/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-v": predict.Nothing, 11 | "--version": predict.Nothing, 12 | "-h": predict.Nothing, 13 | "--help": predict.Nothing, 14 | "--completions-install": predict.Nothing, 15 | "--completions-bash": predict.Nothing, 16 | "--completions-zsh": predict.Nothing, 17 | "--completions-fish": predict.Nothing, 18 | }, 19 | } 20 | 21 | func handleCompletions() { 22 | completions.Complete(progBase) 23 | } 24 | -------------------------------------------------------------------------------- /range2ip/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.0.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/range2ip-${VSN}/range2ip_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i range2ip_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i range2ip_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm range2ip_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `range2ip`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /range2ip/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: range2ip 2 | Section: utils 3 | Version: 1.0.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: range2ip 10 | Architecture: amd64 11 | Description: A simple tool for converting IP ranges to individual IPs within those ranges. 12 | -------------------------------------------------------------------------------- /range2ip/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "range2ip" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /range2ip/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.0.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/range2ip-${VSN}/range2ip_${VSN}_${PLAT}.tar.gz 9 | tar -xf range2ip_${VSN}_${PLAT}.tar.gz 10 | rm range2ip_${VSN}_${PLAT}.tar.gz 11 | sudo mv range2ip_${VSN}_${PLAT} /usr/local/bin/range2ip 12 | 13 | echo 14 | echo 'You can now run `range2ip`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /range2ip/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "range2ip" $VSN 13 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for cli $1. 4 | 5 | DIR=`dirname $0` 6 | ROOT=$DIR/.. 7 | 8 | CLI=$1 9 | 10 | go build \ 11 | -o $ROOT/build/${CLI} \ 12 | $ROOT/${CLI} 13 | -------------------------------------------------------------------------------- /scripts/changelog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # NOTE: Github actions uses this script. 4 | # Get changelog of cli $1 & version $2 from CHANGELOG.md. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | CLI=$1 12 | VERSION=$2 13 | 14 | found=0 15 | 16 | cat $ROOT/${CLI}/CHANGELOG.md | while IFS= read "line"; do 17 | # Find the version heading 18 | if [ $found -eq 0 ] && (echo "$line" | grep -q -E "^(#|##) $VERSION$"); then 19 | found=1 20 | continue 21 | fi 22 | 23 | # Reaching next delimiter - stop 24 | if [ $found -eq 1 ] && (echo "$line" | grep -q -E "^(#|##) [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+"); then 25 | found=0 26 | break 27 | fi 28 | 29 | # Keep printing out lines as no other version delimiter found 30 | if [ $found -eq 1 ]; then 31 | echo "$line" 32 | fi 33 | done 34 | -------------------------------------------------------------------------------- /scripts/ctags.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Regenerate ctags. 4 | 5 | ctags \ 6 | --recurse=yes \ 7 | --exclude=node_modules \ 8 | --exclude=dist \ 9 | --exclude=build \ 10 | --exclude=target \ 11 | -f .vim/tags \ 12 | --tag-relative=never \ 13 | --totals=yes \ 14 | ./lib \ 15 | ./ipinfo \ 16 | ./grepdomain \ 17 | ./grepip \ 18 | ./matchip 19 | -------------------------------------------------------------------------------- /scripts/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build (and optionally upload to Dockerhub) for CLI $1 & version $2. 4 | # version ($2) will be set to `latest` in case not provided. 5 | # additionally --release, -r to release container to Dockerhub. 6 | # note: if you want to release as well, you should be logged in with `docker`. 7 | 8 | set -e 9 | 10 | DIR=`dirname $0` 11 | ROOT=$DIR/.. 12 | 13 | CLI=$1 14 | VSN=$2 15 | RELEASE=$3 16 | 17 | if [ -z "$CLI" ]; then 18 | echo "require cli as first parameter" 2>&1 19 | exit 1 20 | fi 21 | 22 | if [ -z "$VSN" ]; then 23 | VSN="latest" 24 | fi 25 | 26 | 27 | # build 28 | # disable CGO to make static binary 29 | CGO_ENABLED=0 go build \ 30 | -o $ROOT/${CLI}/build/$CLI \ 31 | $ROOT/${CLI} 32 | 33 | # docker container 34 | docker build --tag ipinfo/$CLI:$VSN $ROOT/$CLI/ 35 | 36 | # cleanup 37 | rm -r $ROOT/$CLI/build 38 | 39 | if [ "$RELEASE" = "-r" ] || [ "$RELEASE" = "--release" ]; then 40 | # push on docker hub 41 | docker push ipinfo/$CLI:$VSN 42 | fi 43 | -------------------------------------------------------------------------------- /scripts/fmt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=`dirname $0` 4 | ROOT=$DIR/.. 5 | 6 | # Format code in project. 7 | 8 | gofmt -w \ 9 | $ROOT/lib \ 10 | $ROOT/ipinfo \ 11 | $ROOT/grepip \ 12 | $ROOT/grepdomain \ 13 | $ROOT/matchip \ 14 | $ROOT/prips \ 15 | $ROOT/cidr2range \ 16 | $ROOT/range2cidr \ 17 | $ROOT/range2ip \ 18 | $ROOT/cidr2ip \ 19 | $ROOT/splitcidr \ 20 | $ROOT/randip 21 | -------------------------------------------------------------------------------- /scripts/lint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Lint all files in the project. 4 | 5 | golint \ 6 | ./lib/... \ 7 | ./ipinfo/... \ 8 | ./grepip/... \ 9 | ./grepdomain/... \ 10 | ./matchip/... \ 11 | ./prips/... \ 12 | ./cidr2range/... \ 13 | ./range2cidr/... \ 14 | ./range2ip/... \ 15 | ./cidr2ip/... \ 16 | ./splitcidr/... \ 17 | ./randip/... 18 | -------------------------------------------------------------------------------- /scripts/release-ppa.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and to upload IPinfo offical PPA. 4 | 5 | DIR=`dirname $0` 6 | ROOT=$DIR/.. 7 | 8 | VSN=$1 9 | KEY=$2 10 | 11 | if [ -z "$VSN" ]; then 12 | echo "require version as first parameter" 2>&1 13 | exit 1 14 | fi 15 | 16 | if [ -z "$KEY" ]; then 17 | echo "require gpg key as second parameter" 2>&1 18 | exit 1 19 | fi 20 | 21 | # building the package 22 | cd $ROOT 23 | debuild -us -uc -S -d 24 | 25 | # signing the package 26 | cd $ROOT/.. 27 | debsign -k $KEY ipinfo_${VSN}.dsc ipinfo_${VSN}_source.changes 28 | 29 | # uploading the package to ppa 30 | dput ppa:ipinfo/ppa ipinfo_${VSN}_source.changes 31 | -------------------------------------------------------------------------------- /splitcidr/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | * Initial release of splitcidr which splits larger CIDRs into smaller CIDRs. 4 | -------------------------------------------------------------------------------- /splitcidr/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:latest 3 | 4 | WORKDIR /splitcidr 5 | COPY build/splitcidr ./ 6 | ENTRYPOINT ["/splitcidr/splitcidr"] 7 | -------------------------------------------------------------------------------- /splitcidr/build-all-platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build binary for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/build-all-platforms.sh "splitcidr" $VSN 13 | -------------------------------------------------------------------------------- /splitcidr/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build local binary. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | $ROOT/scripts/build.sh "splitcidr" 11 | -------------------------------------------------------------------------------- /splitcidr/completions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/ipinfo/cli/lib/complete" 5 | "github.com/ipinfo/cli/lib/complete/predict" 6 | ) 7 | 8 | var completions = &complete.Command{ 9 | Flags: map[string]complete.Predictor{ 10 | "-v": predict.Nothing, 11 | "--version": predict.Nothing, 12 | "-h": predict.Nothing, 13 | "--help": predict.Nothing, 14 | "--completions-install": predict.Nothing, 15 | "--completions-bash": predict.Nothing, 16 | "--completions-zsh": predict.Nothing, 17 | "--completions-fish": predict.Nothing, 18 | }, 19 | } 20 | 21 | func handleCompletions() { 22 | completions.Complete(progBase) 23 | } 24 | -------------------------------------------------------------------------------- /splitcidr/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VSN=1.0.0 4 | DEFAULT_ARCH=amd64 5 | 6 | ARCH=$(uname -m) 7 | case $ARCH in 8 | x86_64) 9 | ARCH_NAME="amd64" 10 | ;; 11 | i386|i686) 12 | ARCH_NAME="386" 13 | ;; 14 | aarch64) 15 | ARCH_NAME="arm64" 16 | ;; 17 | armv7l) 18 | ARCH_NAME="arm" 19 | ;; 20 | *) 21 | ARCH_NAME=$DEFAULT_ARCH 22 | ;; 23 | esac 24 | curl -LO https://github.com/ipinfo/cli/releases/download/splitcidr-${VSN}/splitcidr_${VSN}_linux_${ARCH_NAME}.deb 25 | if command -v sudo >/dev/null 2>&1; then 26 | sudo dpkg -i splitcidr_${VSN}_linux_${ARCH_NAME}.deb 27 | else 28 | dpkg -i splitcidr_${VSN}_linux_${ARCH_NAME}.deb 29 | fi 30 | rm splitcidr_${VSN}_linux_${ARCH_NAME}.deb 31 | 32 | echo 33 | echo 'You can now run `splitcidr`'. 34 | 35 | if [ -f "$0" ]; then 36 | rm $0 37 | fi 38 | -------------------------------------------------------------------------------- /splitcidr/dist/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: splitcidr 2 | Section: utils 3 | Version: 1.0.0 4 | Priority: optional 5 | Maintainer: IPinfo 6 | Vcs-Git: https://github.com/ipinfo/cli 7 | Vcs-browser: https://github.com/ipinfo/cli 8 | Homepage: https://ipinfo.io 9 | Package: splitcidr 10 | Architecture: amd64 11 | Description: A simple tool for splitting larger CIDRs into smaller CIDRs. 12 | -------------------------------------------------------------------------------- /splitcidr/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to Dockerhub) for all platforms for version $1. 4 | # Use `-r` or `--release` after the version to also push to Dockerhub. 5 | 6 | set -e 7 | 8 | DIR=`dirname $0` 9 | ROOT=$DIR/.. 10 | 11 | VSN=$1 12 | RELEASE=$2 13 | 14 | $ROOT/scripts/docker.sh "splitcidr" $VSN $RELEASE 15 | -------------------------------------------------------------------------------- /splitcidr/macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | VSN=1.0.0 6 | PLAT=darwin_amd64 7 | 8 | curl -LO https://github.com/ipinfo/cli/releases/download/splitcidr-${VSN}/splitcidr_${VSN}_${PLAT}.tar.gz 9 | tar -xf splitcidr_${VSN}_${PLAT}.tar.gz 10 | rm splitcidr_${VSN}_${PLAT}.tar.gz 11 | sudo mv splitcidr_${VSN}_${PLAT} /usr/local/bin/splitcidr 12 | 13 | echo 14 | echo 'You can now run `splitcidr`.' 15 | 16 | if [ -f "$0" ]; then 17 | rm "$0" 18 | fi 19 | -------------------------------------------------------------------------------- /splitcidr/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and upload (to GitHub) for all platforms for version $1. 4 | 5 | set -e 6 | 7 | DIR=`dirname $0` 8 | ROOT=$DIR/.. 9 | 10 | VSN=$1 11 | 12 | $ROOT/scripts/release.sh "splitcidr" $VSN 13 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/github.com/fatih/color/color_windows.go: -------------------------------------------------------------------------------- 1 | package color 2 | 3 | import ( 4 | "os" 5 | 6 | "golang.org/x/sys/windows" 7 | ) 8 | 9 | func init() { 10 | // Opt-in for ansi color support for current process. 11 | // https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#output-sequences 12 | var outMode uint32 13 | out := windows.Handle(os.Stdout.Fd()) 14 | if err := windows.GetConsoleMode(out, &outMode); err != nil { 15 | return 16 | } 17 | outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING 18 | _ = windows.SetConsoleMode(out, outMode) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/Makefile: -------------------------------------------------------------------------------- 1 | TEST?=./... 2 | 3 | default: test 4 | 5 | # test runs the test suite and vets the code. 6 | test: generate 7 | @echo "==> Running tests..." 8 | @go list $(TEST) \ 9 | | grep -v "/vendor/" \ 10 | | xargs -n1 go test -timeout=60s -parallel=10 ${TESTARGS} 11 | 12 | # testrace runs the race checker 13 | testrace: generate 14 | @echo "==> Running tests (race)..." 15 | @go list $(TEST) \ 16 | | grep -v "/vendor/" \ 17 | | xargs -n1 go test -timeout=60s -race ${TESTARGS} 18 | 19 | # updatedeps installs all the dependencies needed to run and build. 20 | updatedeps: 21 | @sh -c "'${CURDIR}/scripts/deps.sh' '${NAME}'" 22 | 23 | # generate runs `go generate` to build the dynamically generated source files. 24 | generate: 25 | @echo "==> Generating..." 26 | @find . -type f -name '.DS_Store' -delete 27 | @go list ./... \ 28 | | grep -v "/vendor/" \ 29 | | xargs -n1 go generate 30 | 31 | .PHONY: default test testrace updatedeps generate 32 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/flatten.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Flatten flattens the given error, merging any *Errors together into 4 | // a single *Error. 5 | func Flatten(err error) error { 6 | // If it isn't an *Error, just return the error as-is 7 | if _, ok := err.(*Error); !ok { 8 | return err 9 | } 10 | 11 | // Otherwise, make the result and flatten away! 12 | flatErr := new(Error) 13 | flatten(err, flatErr) 14 | return flatErr 15 | } 16 | 17 | func flatten(err error, flatErr *Error) { 18 | switch err := err.(type) { 19 | case *Error: 20 | for _, e := range err.Errors { 21 | flatten(e, flatErr) 22 | } 23 | default: 24 | flatErr.Errors = append(flatErr.Errors, err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/format.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // ErrorFormatFunc is a function callback that is called by Error to 9 | // turn the list of errors into a string. 10 | type ErrorFormatFunc func([]error) string 11 | 12 | // ListFormatFunc is a basic formatter that outputs the number of errors 13 | // that occurred along with a bullet point list of the errors. 14 | func ListFormatFunc(es []error) string { 15 | if len(es) == 1 { 16 | return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", es[0]) 17 | } 18 | 19 | points := make([]string, len(es)) 20 | for i, err := range es { 21 | points[i] = fmt.Sprintf("* %s", err) 22 | } 23 | 24 | return fmt.Sprintf( 25 | "%d errors occurred:\n\t%s\n\n", 26 | len(es), strings.Join(points, "\n\t")) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/group.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import "sync" 4 | 5 | // Group is a collection of goroutines which return errors that need to be 6 | // coalesced. 7 | type Group struct { 8 | mutex sync.Mutex 9 | err *Error 10 | wg sync.WaitGroup 11 | } 12 | 13 | // Go calls the given function in a new goroutine. 14 | // 15 | // If the function returns an error it is added to the group multierror which 16 | // is returned by Wait. 17 | func (g *Group) Go(f func() error) { 18 | g.wg.Add(1) 19 | 20 | go func() { 21 | defer g.wg.Done() 22 | 23 | if err := f(); err != nil { 24 | g.mutex.Lock() 25 | g.err = Append(g.err, err) 26 | g.mutex.Unlock() 27 | } 28 | }() 29 | } 30 | 31 | // Wait blocks until all function calls from the Go method have returned, then 32 | // returns the multierror. 33 | func (g *Group) Wait() *Error { 34 | g.wg.Wait() 35 | g.mutex.Lock() 36 | defer g.mutex.Unlock() 37 | return g.err 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/prefix.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/errwrap" 7 | ) 8 | 9 | // Prefix is a helper function that will prefix some text 10 | // to the given error. If the error is a multierror.Error, then 11 | // it will be prefixed to each wrapped error. 12 | // 13 | // This is useful to use when appending multiple multierrors 14 | // together in order to give better scoping. 15 | func Prefix(err error, prefix string) error { 16 | if err == nil { 17 | return nil 18 | } 19 | 20 | format := fmt.Sprintf("%s {{err}}", prefix) 21 | switch err := err.(type) { 22 | case *Error: 23 | // Typed nils can reach here, so initialize if we are nil 24 | if err == nil { 25 | err = new(Error) 26 | } 27 | 28 | // Wrap each of the errors 29 | for i, e := range err.Errors { 30 | err.Errors[i] = errwrap.Wrapf(format, e) 31 | } 32 | 33 | return err 34 | default: 35 | return errwrap.Wrapf(format, err) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/sort.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Len implements sort.Interface function for length 4 | func (err Error) Len() int { 5 | return len(err.Errors) 6 | } 7 | 8 | // Swap implements sort.Interface function for swapping elements 9 | func (err Error) Swap(i, j int) { 10 | err.Errors[i], err.Errors[j] = err.Errors[j], err.Errors[i] 11 | } 12 | 13 | // Less implements sort.Interface function for determining order 14 | func (err Error) Less(i, j int) bool { 15 | return err.Errors[i].Error() < err.Errors[j].Error() 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/ipinfo/go/v2/ipinfo/cache.go: -------------------------------------------------------------------------------- 1 | package ipinfo 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ipinfo/go/v2/ipinfo/cache" 7 | ) 8 | 9 | const cacheKeyVsn = "2" 10 | 11 | // Cache represents the internal cache used by the IPinfo client. 12 | type Cache struct { 13 | cache.Interface 14 | } 15 | 16 | // NewCache creates a new cache given a specific engine. 17 | func NewCache(engine cache.Interface) *Cache { 18 | return &Cache{Interface: engine} 19 | } 20 | 21 | // return a versioned cache key. 22 | func cacheKey(k string) string { 23 | return fmt.Sprintf("%s:%s", k, cacheKeyVsn) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/ipinfo/go/v2/ipinfo/cache/interface.go: -------------------------------------------------------------------------------- 1 | package cache 2 | 3 | import "errors" 4 | 5 | var ( 6 | // ErrNotFound means that the key was not found. 7 | ErrNotFound = errors.New("key not found") 8 | ) 9 | 10 | // Interface is the cache interface that all cache implementations must adhere 11 | // to at the minimum to be usable in the IPinfo client. 12 | // 13 | // Note that all implementations must be concurrency-safe. 14 | type Interface interface { 15 | // Get a value from the cache given a key. 16 | // 17 | // This must be concurrency-safe. 18 | Get(key string) (interface{}, error) 19 | 20 | // Set a key to value mapping in the cache. 21 | // 22 | // This must be concurrency-safe. 23 | Set(key string, value interface{}) error 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/ipinfo/go/v2/ipinfo/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package ipinfo provides a client for using the IPinfo API. 3 | 4 | Usage: 5 | 6 | import "github.com/ipinfo/go/v2/ipinfo" 7 | 8 | The default IPinfo client is predefined and can be used without initialization. 9 | For example: 10 | 11 | info, err := ipinfo.GetIPInfo(net.ParseIP("8.8.8.8")) 12 | 13 | Authorization 14 | 15 | To perform authorized API calls with more data and higher limits, pass in a 16 | non-empty token to NewClient. For example: 17 | 18 | client := ipinfo.NewClient(nil, nil, "MY_TOKEN") 19 | info, err := client.GetIPInfo(net.ParseIP("8.8.8.8")) 20 | */ 21 | package ipinfo 22 | -------------------------------------------------------------------------------- /vendor/github.com/ipinfo/go/v2/ipinfo/ipinfo.go: -------------------------------------------------------------------------------- 1 | package ipinfo 2 | 3 | // DefaultClient is the package-level client available to the user. 4 | var DefaultClient *Client 5 | 6 | func init() { 7 | // create a global, default client. 8 | DefaultClient = NewClient(nil, nil, "") 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/ipinfo/mmdbctl/lib/reader.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | type reader interface { 4 | Read() (record []string, err error) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/ipinfo/mmdbctl/lib/reader_tsv.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "strings" 7 | ) 8 | 9 | type TsvReader struct { 10 | r *bufio.Reader 11 | } 12 | 13 | func NewTsvReader(r io.Reader) *TsvReader { 14 | return &TsvReader{ 15 | r: bufio.NewReader(r), 16 | } 17 | } 18 | 19 | func (r *TsvReader) Read() (record []string, err error) { 20 | line, err := r.r.ReadString('\n') 21 | 22 | // equivalent to perl chomp: remove all extra ending newline content. 23 | line = strings.TrimRight(line, "\r\n") 24 | 25 | // if this was the end but we have stuff, don't EOF just yet - let the user 26 | // handle this line, then the underlying reader will EOF on the next read. 27 | if len(line) > 0 && err == io.EOF { 28 | err = nil 29 | } 30 | 31 | return strings.Split(line, "\t"), err 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/ipinfo/mmdbctl/lib/writer.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | type writer interface { 4 | Write(record []string) error 5 | Flush() 6 | Error() error 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/ipinfo/mmdbctl/lib/writer_tsv.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "strings" 7 | ) 8 | 9 | type TsvWriter struct { 10 | w io.Writer 11 | } 12 | 13 | func NewTsvWriter(w io.Writer) *TsvWriter { 14 | return &TsvWriter{ 15 | w: w, 16 | } 17 | } 18 | 19 | func (w *TsvWriter) Write(record []string) error { 20 | _, err := fmt.Fprintln(w.w, strings.Join(record, "\t")) 21 | return err 22 | } 23 | 24 | func (w *TsvWriter) Flush() { 25 | } 26 | 27 | func (w *TsvWriter) Error() error { 28 | return nil 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | clone_folder: c:\projects\src\github.com\jszwec\csvutil 4 | 5 | environment: 6 | PATH: c:\projects\bin;%PATH% 7 | GOPATH: c:\projects 8 | GOVERSION: 1.11 9 | 10 | install: 11 | - rmdir c:\go /s /q 12 | - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.zip 13 | - 7z x go%GOVERSION%.windows-amd64.zip -y -oC:\ > NUL 14 | 15 | - cd %APPVEYOR_BUILD_FOLDER% 16 | - go version 17 | - go get -v -t ./... 18 | 19 | build_script: 20 | - go tool vet -all . 21 | - go install ./... 22 | - go test -race -v ./... 23 | 24 | test: off 25 | 26 | deploy: off 27 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - "1.7.x" 5 | - "1.8.x" 6 | - "1.9.x" 7 | - "1.10.x" 8 | - "1.14.x" 9 | 10 | os: 11 | - linux 12 | - osx 13 | 14 | script: 15 | - go vet ./... 16 | - go install ./... 17 | - go test -race -v ./... -coverprofile=coverage.txt -covermode=atomic 18 | 19 | after_success: 20 | - bash <(curl -s https://codecov.io/bash) 21 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | markdown: GFM 3 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/cache_go17.go: -------------------------------------------------------------------------------- 1 | // +build !go1.9 2 | 3 | package csvutil 4 | 5 | import ( 6 | "sync" 7 | ) 8 | 9 | var fieldCache = struct { 10 | mtx sync.RWMutex 11 | m map[typeKey][]field 12 | }{m: make(map[typeKey][]field)} 13 | 14 | func cachedFields(k typeKey) fields { 15 | fieldCache.mtx.RLock() 16 | fields, ok := fieldCache.m[k] 17 | fieldCache.mtx.RUnlock() 18 | 19 | if ok { 20 | return fields 21 | } 22 | 23 | fields = buildFields(k) 24 | 25 | fieldCache.mtx.Lock() 26 | fieldCache.m[k] = fields 27 | fieldCache.mtx.Unlock() 28 | 29 | return fields 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/cache_go19.go: -------------------------------------------------------------------------------- 1 | // +build go1.9 2 | 3 | package csvutil 4 | 5 | import ( 6 | "sync" 7 | ) 8 | 9 | var fieldCache sync.Map // map[typeKey][]field 10 | 11 | func cachedFields(k typeKey) fields { 12 | if v, ok := fieldCache.Load(k); ok { 13 | return v.(fields) 14 | } 15 | 16 | v, _ := fieldCache.LoadOrStore(k, buildFields(k)) 17 | return v.(fields) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/csvutil_go17.go: -------------------------------------------------------------------------------- 1 | // +build !go1.9 2 | 3 | package csvutil 4 | 5 | import ( 6 | "encoding/csv" 7 | "io" 8 | ) 9 | 10 | func newCSVReader(r io.Reader) *csv.Reader { 11 | return csv.NewReader(r) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/csvutil_go19.go: -------------------------------------------------------------------------------- 1 | // +build go1.9 2 | 3 | package csvutil 4 | 5 | import ( 6 | "encoding/csv" 7 | "io" 8 | ) 9 | 10 | func newCSVReader(r io.Reader) *csv.Reader { 11 | rr := csv.NewReader(r) 12 | rr.ReuseRecord = true 13 | return rr 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/doc.go: -------------------------------------------------------------------------------- 1 | // Package csvutil provides fast and idiomatic mapping between CSV and Go values. 2 | // 3 | // This package does not provide a CSV parser itself, it is based on the Reader and Writer 4 | // interfaces which are implemented by eg. std csv package. This gives a possibility 5 | // of choosing any other CSV writer or reader which may be more performant. 6 | package csvutil 7 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/interface.go: -------------------------------------------------------------------------------- 1 | package csvutil 2 | 3 | // Reader provides the interface for reading a single CSV record. 4 | // 5 | // If there is no data left to be read, Read returns (nil, io.EOF). 6 | // 7 | // It is implemented by csv.Reader. 8 | type Reader interface { 9 | Read() ([]string, error) 10 | } 11 | 12 | // Writer provides the interface for writing a single CSV record. 13 | // 14 | // It is implemented by csv.Writer. 15 | type Writer interface { 16 | Write([]string) error 17 | } 18 | 19 | // Unmarshaler is the interface implemented by types that can unmarshal 20 | // a single record's field description of themselves. 21 | type Unmarshaler interface { 22 | UnmarshalCSV([]byte) error 23 | } 24 | 25 | // Marshaler is the interface implemented by types that can marshal themselves 26 | // into valid string. 27 | type Marshaler interface { 28 | MarshalCSV() ([]byte, error) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/jszwec/csvutil/tag.go: -------------------------------------------------------------------------------- 1 | package csvutil 2 | 3 | import ( 4 | "reflect" 5 | "strings" 6 | ) 7 | 8 | type tag struct { 9 | name string 10 | prefix string 11 | empty bool 12 | omitEmpty bool 13 | ignore bool 14 | inline bool 15 | } 16 | 17 | func parseTag(tagname string, field reflect.StructField) (t tag) { 18 | tags := strings.Split(field.Tag.Get(tagname), ",") 19 | if len(tags) == 1 && tags[0] == "" { 20 | t.name = field.Name 21 | t.empty = true 22 | return 23 | } 24 | 25 | switch tags[0] { 26 | case "-": 27 | t.ignore = true 28 | return 29 | case "": 30 | t.name = field.Name 31 | default: 32 | t.name = tags[0] 33 | } 34 | 35 | for _, tagOpt := range tags[1:] { 36 | switch tagOpt { 37 | case "omitempty": 38 | t.omitEmpty = true 39 | case "inline": 40 | if walkType(field.Type).Kind() == reflect.Struct { 41 | t.inline = true 42 | t.prefix = tags[0] 43 | } 44 | } 45 | } 46 | return 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_appengine.go: -------------------------------------------------------------------------------- 1 | //go:build appengine 2 | // +build appengine 3 | 4 | package colorable 5 | 6 | import ( 7 | "io" 8 | "os" 9 | 10 | _ "github.com/mattn/go-isatty" 11 | ) 12 | 13 | // NewColorable returns new instance of Writer which handles escape sequence. 14 | func NewColorable(file *os.File) io.Writer { 15 | if file == nil { 16 | panic("nil passed instead of *os.File to NewColorable()") 17 | } 18 | 19 | return file 20 | } 21 | 22 | // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. 23 | func NewColorableStdout() io.Writer { 24 | return os.Stdout 25 | } 26 | 27 | // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. 28 | func NewColorableStderr() io.Writer { 29 | return os.Stderr 30 | } 31 | 32 | // EnableColorsStdout enable colors if possible. 33 | func EnableColorsStdout(enabled *bool) func() { 34 | if enabled != nil { 35 | *enabled = true 36 | } 37 | return func() {} 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_others.go: -------------------------------------------------------------------------------- 1 | //go:build !windows && !appengine 2 | // +build !windows,!appengine 3 | 4 | package colorable 5 | 6 | import ( 7 | "io" 8 | "os" 9 | 10 | _ "github.com/mattn/go-isatty" 11 | ) 12 | 13 | // NewColorable returns new instance of Writer which handles escape sequence. 14 | func NewColorable(file *os.File) io.Writer { 15 | if file == nil { 16 | panic("nil passed instead of *os.File to NewColorable()") 17 | } 18 | 19 | return file 20 | } 21 | 22 | // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. 23 | func NewColorableStdout() io.Writer { 24 | return os.Stdout 25 | } 26 | 27 | // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. 28 | func NewColorableStderr() io.Writer { 29 | return os.Stderr 30 | } 31 | 32 | // EnableColorsStdout enable colors if possible. 33 | func EnableColorsStdout(enabled *bool) func() { 34 | if enabled != nil { 35 | *enabled = true 36 | } 37 | return func() {} 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/go.test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | echo "" > coverage.txt 5 | 6 | for d in $(go list ./... | grep -v vendor); do 7 | go test -race -coverprofile=profile.out -covermode=atomic "$d" 8 | if [ -f profile.out ]; then 9 | cat profile.out >> coverage.txt 10 | rm profile.out 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/go.test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | echo "" > coverage.txt 5 | 6 | for d in $(go list ./... | grep -v vendor); do 7 | go test -race -coverprofile=profile.out -covermode=atomic "$d" 8 | if [ -f profile.out ]; then 9 | cat profile.out >> coverage.txt 10 | rm profile.out 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | //go:build (darwin || freebsd || openbsd || netbsd || dragonfly || hurd) && !appengine && !tinygo 2 | // +build darwin freebsd openbsd netbsd dragonfly hurd 3 | // +build !appengine 4 | // +build !tinygo 5 | 6 | package isatty 7 | 8 | import "golang.org/x/sys/unix" 9 | 10 | // IsTerminal return true if the file descriptor is terminal. 11 | func IsTerminal(fd uintptr) bool { 12 | _, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA) 13 | return err == nil 14 | } 15 | 16 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 17 | // terminal. This is also always false on this environment. 18 | func IsCygwinTerminal(fd uintptr) bool { 19 | return false 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_others.go: -------------------------------------------------------------------------------- 1 | //go:build (appengine || js || nacl || tinygo || wasm) && !windows 2 | // +build appengine js nacl tinygo wasm 3 | // +build !windows 4 | 5 | package isatty 6 | 7 | // IsTerminal returns true if the file descriptor is terminal which 8 | // is always false on js and appengine classic which is a sandboxed PaaS. 9 | func IsTerminal(fd uintptr) bool { 10 | return false 11 | } 12 | 13 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 14 | // terminal. This is also always false on this environment. 15 | func IsCygwinTerminal(fd uintptr) bool { 16 | return false 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_plan9.go: -------------------------------------------------------------------------------- 1 | //go:build plan9 2 | // +build plan9 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | func IsTerminal(fd uintptr) bool { 12 | path, err := syscall.Fd2path(int(fd)) 13 | if err != nil { 14 | return false 15 | } 16 | return path == "/dev/cons" || path == "/mnt/term/dev/cons" 17 | } 18 | 19 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 20 | // terminal. This is also always false on this environment. 21 | func IsCygwinTerminal(fd uintptr) bool { 22 | return false 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | //go:build solaris && !appengine 2 | // +build solaris,!appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: https://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | _, err := unix.IoctlGetTermio(int(fd), unix.TCGETA) 14 | return err == nil 15 | } 16 | 17 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 18 | // terminal. This is also always false on this environment. 19 | func IsCygwinTerminal(fd uintptr) bool { 20 | return false 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_tcgets.go: -------------------------------------------------------------------------------- 1 | //go:build (linux || aix || zos) && !appengine && !tinygo 2 | // +build linux aix zos 3 | // +build !appengine 4 | // +build !tinygo 5 | 6 | package isatty 7 | 8 | import "golang.org/x/sys/unix" 9 | 10 | // IsTerminal return true if the file descriptor is terminal. 11 | func IsTerminal(fd uintptr) bool { 12 | _, err := unix.IoctlGetTermios(int(fd), unix.TCGETS) 13 | return err == nil 14 | } 15 | 16 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 17 | // terminal. This is also always false on this environment. 18 | func IsCygwinTerminal(fd uintptr) bool { 19 | return false 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/maxmind/mmdbwriter/.gitignore: -------------------------------------------------------------------------------- 1 | *.sw? 2 | -------------------------------------------------------------------------------- /vendor/github.com/maxmind/mmdbwriter/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy of 2 | this software and associated documentation files (the "Software"), to deal in 3 | the Software without restriction, including without limitation the rights to 4 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 5 | of the Software, and to permit persons to whom the Software is furnished to do 6 | so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all 9 | copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 17 | SOFTWARE. 18 | -------------------------------------------------------------------------------- /vendor/github.com/maxmind/mmdbwriter/README.md: -------------------------------------------------------------------------------- 1 | # Go MaxMind DB Writer 2 | 3 | [![Go Reference](https://pkg.go.dev/badge/github.com/maxmind/mmdbwriter.svg)](https://pkg.go.dev/github.com/maxmind/mmdbwriter) 4 | 5 | This is a Go writer for the [MaxMind DB format](https://github.com/maxmind/MaxMind-DB). 6 | 7 | This is still a work in progress and does not support all of the features 8 | of the [Perl writer](https://github.com/maxmind/MaxMind-DB-Reader-perl). The 9 | API is subject to change. 10 | 11 | ## Examples 12 | 13 | See the `examples` folder for examples of how to use this library or our blog 14 | post, 15 | [Enriching MMDB files with your own data using Go](https://blog.maxmind.com/2020/09/01/enriching-mmdb-files-with-your-own-data-using-go/). 16 | 17 | ## Copyright and License 18 | 19 | This software is Copyright (c) 2020 by MaxMind, Inc. 20 | 21 | This is free software, licensed under the [Apache License, Version 22 | 2.0](LICENSE-APACHE) or the [MIT License](LICENSE-MIT), at your option. 23 | -------------------------------------------------------------------------------- /vendor/github.com/oschwald/maxminddb-golang/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | *.out 3 | *.sw? 4 | *.test 5 | -------------------------------------------------------------------------------- /vendor/github.com/oschwald/maxminddb-golang/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test-data"] 2 | path = test-data 3 | url = https://github.com/maxmind/MaxMind-DB.git 4 | -------------------------------------------------------------------------------- /vendor/github.com/oschwald/maxminddb-golang/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2015, Gregory J. Oschwald 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/github.com/oschwald/maxminddb-golang/deserializer.go: -------------------------------------------------------------------------------- 1 | package maxminddb 2 | 3 | import "math/big" 4 | 5 | // deserializer is an interface for a type that deserializes an MaxMind DB 6 | // data record to some other type. This exists as an alternative to the 7 | // standard reflection API. 8 | // 9 | // This is fundamentally different than the Unmarshaler interface that 10 | // several packages provide. A Deserializer will generally create the 11 | // final struct or value rather than unmarshaling to itself. 12 | // 13 | // This interface and the associated unmarshaling code is EXPERIMENTAL! 14 | // It is not currently covered by any Semantic Versioning guarantees. 15 | // Use at your own risk. 16 | type deserializer interface { 17 | ShouldSkip(offset uintptr) (bool, error) 18 | StartSlice(size uint) error 19 | StartMap(size uint) error 20 | End() error 21 | String(string) error 22 | Float64(float64) error 23 | Bytes([]byte) error 24 | Uint16(uint16) error 25 | Uint32(uint32) error 26 | Int32(int32) error 27 | Uint64(uint64) error 28 | Uint128(*big.Int) error 29 | Bool(bool) error 30 | Float32(float32) error 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/oschwald/maxminddb-golang/mmap_unix.go: -------------------------------------------------------------------------------- 1 | //go:build !windows && !appengine && !plan9 && !js && !wasip1 && !wasi 2 | // +build !windows,!appengine,!plan9,!js,!wasip1,!wasi 3 | 4 | package maxminddb 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | func mmap(fd, length int) (data []byte, err error) { 11 | return unix.Mmap(fd, 0, length, unix.PROT_READ, unix.MAP_SHARED) 12 | } 13 | 14 | func munmap(b []byte) (err error) { 15 | return unix.Munmap(b) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/oschwald/maxminddb-golang/reader_memory.go: -------------------------------------------------------------------------------- 1 | //go:build appengine || plan9 || js || wasip1 || wasi 2 | // +build appengine plan9 js wasip1 wasi 3 | 4 | package maxminddb 5 | 6 | import "io/ioutil" 7 | 8 | // Open takes a string path to a MaxMind DB file and returns a Reader 9 | // structure or an error. The database file is opened using a memory map 10 | // on supported platforms. On platforms without memory map support, such 11 | // as WebAssembly or Google App Engine, the database is loaded into memory. 12 | // Use the Close method on the Reader object to return the resources to the system. 13 | func Open(file string) (*Reader, error) { 14 | bytes, err := ioutil.ReadFile(file) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | return FromBytes(bytes) 20 | } 21 | 22 | // Close returns the resources used by the database to the system. 23 | func (r *Reader) Close() error { 24 | r.buffer = nil 25 | return nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/oschwald/maxminddb-golang/set_zero_120.go: -------------------------------------------------------------------------------- 1 | //go:build go1.20 2 | // +build go1.20 3 | 4 | package maxminddb 5 | 6 | import "reflect" 7 | 8 | func reflectSetZero(v reflect.Value) { 9 | v.SetZero() 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/oschwald/maxminddb-golang/set_zero_pre120.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.20 2 | // +build !go1.20 3 | 4 | package maxminddb 5 | 6 | import "reflect" 7 | 8 | func reflectSetZero(v reflect.Value) { 9 | v.Set(reflect.Zero(v.Type())) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/patrickmn/go-cache/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | This is a list of people who have contributed code to go-cache. They, or their 2 | employers, are the copyright holders of the contributed code. Contributed code 3 | is subject to the license restrictions listed in LICENSE (as they were when the 4 | code was contributed.) 5 | 6 | Dustin Sallings 7 | Jason Mooberry 8 | Sergey Shepelev 9 | Alex Edwards 10 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/browser/browser_darwin.go: -------------------------------------------------------------------------------- 1 | package browser 2 | 3 | import "os/exec" 4 | 5 | func openBrowser(url string) error { 6 | return runCmd("open", url) 7 | } 8 | 9 | func setFlags(cmd *exec.Cmd) {} 10 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/browser/browser_freebsd.go: -------------------------------------------------------------------------------- 1 | package browser 2 | 3 | import ( 4 | "errors" 5 | "os/exec" 6 | ) 7 | 8 | func openBrowser(url string) error { 9 | err := runCmd("xdg-open", url) 10 | if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound { 11 | return errors.New("xdg-open: command not found - install xdg-utils from ports(8)") 12 | } 13 | return err 14 | } 15 | 16 | func setFlags(cmd *exec.Cmd) {} 17 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/browser/browser_linux.go: -------------------------------------------------------------------------------- 1 | package browser 2 | 3 | import ( 4 | "os/exec" 5 | "strings" 6 | ) 7 | 8 | func openBrowser(url string) error { 9 | providers := []string{"xdg-open", "x-www-browser", "www-browser"} 10 | 11 | // There are multiple possible providers to open a browser on linux 12 | // One of them is xdg-open, another is x-www-browser, then there's www-browser, etc. 13 | // Look for one that exists and run it 14 | for _, provider := range providers { 15 | if _, err := exec.LookPath(provider); err == nil { 16 | return runCmd(provider, url) 17 | } 18 | } 19 | 20 | return &exec.Error{Name: strings.Join(providers, ","), Err: exec.ErrNotFound} 21 | } 22 | 23 | func setFlags(cmd *exec.Cmd) {} 24 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/browser/browser_openbsd.go: -------------------------------------------------------------------------------- 1 | package browser 2 | 3 | import ( 4 | "errors" 5 | "os/exec" 6 | ) 7 | 8 | func openBrowser(url string) error { 9 | err := runCmd("xdg-open", url) 10 | if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound { 11 | return errors.New("xdg-open: command not found - install xdg-utils from ports(8)") 12 | } 13 | return err 14 | } 15 | 16 | func setFlags(cmd *exec.Cmd) {} 17 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/browser/browser_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!windows,!darwin,!openbsd,!freebsd 2 | 3 | package browser 4 | 5 | import ( 6 | "fmt" 7 | "os/exec" 8 | "runtime" 9 | ) 10 | 11 | func openBrowser(url string) error { 12 | return fmt.Errorf("openBrowser: unsupported operating system: %v", runtime.GOOS) 13 | } 14 | 15 | func setFlags(cmd *exec.Cmd) {} 16 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/browser/browser_windows.go: -------------------------------------------------------------------------------- 1 | //go:generate mkwinsyscall -output zbrowser_windows.go browser_windows.go 2 | //sys ShellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) = shell32.ShellExecuteW 3 | package browser 4 | 5 | import "os/exec" 6 | const SW_SHOWNORMAL = 1 7 | 8 | func openBrowser(url string) error { 9 | return ShellExecute(0, "", url, "", "", SW_SHOWNORMAL) 10 | } 11 | 12 | func setFlags(cmd *exec.Cmd) { 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/posener/script/cat.go: -------------------------------------------------------------------------------- 1 | package script 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "io" 7 | "os" 8 | ) 9 | 10 | // Cat outputs the contents of the given files. 11 | // 12 | // Shell command: cat . 13 | func Cat(paths ...string) Stream { 14 | var ( 15 | readers []io.Reader 16 | closers multicloser 17 | merr error 18 | ) 19 | 20 | for _, path := range paths { 21 | f, err := os.Open(path) 22 | if err != nil { 23 | merr = errors.Join(merr, fmt.Errorf("open path %s: %w", path, err)) 24 | } else { 25 | readers = append(readers, f) 26 | closers = append(closers, f) 27 | } 28 | } 29 | 30 | return Stream{ 31 | r: readcloser{Reader: io.MultiReader(readers...), Closer: closers}, 32 | stage: "cat", 33 | err: merr, 34 | } 35 | } 36 | 37 | type multicloser []io.Closer 38 | 39 | func (mc multicloser) Close() error { 40 | var merr error 41 | for _, c := range mc { 42 | if err := c.Close(); err != nil { 43 | merr = errors.Join(merr, err) 44 | } 45 | } 46 | return merr 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/posener/script/from.go: -------------------------------------------------------------------------------- 1 | package script 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "os" 7 | "strings" 8 | ) 9 | 10 | // From creates a stream from a reader. 11 | func From(name string, r io.Reader) Stream { 12 | return Stream{stage: name, r: r} 13 | } 14 | 15 | // Writer creates a stream from a function that writes to a writer. 16 | func Writer(name string, writer func(io.Writer) error) Stream { 17 | b := bytes.NewBuffer(nil) 18 | err := writer(b) 19 | return Stream{stage: name, r: b, err: err} 20 | } 21 | 22 | // Stdin starts a stream from stdin. 23 | func Stdin() Stream { 24 | stdin := io.NopCloser(os.Stdin) // Prevent closing of stdin. 25 | return From("stdin", stdin) 26 | } 27 | 28 | // Echo writes to stdout. 29 | // 30 | // Shell command: `echo ` 31 | func Echo(s string) Stream { 32 | return From("echo", strings.NewReader(s+"\n")) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/posener/script/grep.go: -------------------------------------------------------------------------------- 1 | package script 2 | 3 | import ( 4 | "fmt" 5 | "regexp" 6 | ) 7 | 8 | // Grep filters only line that match the given regexp. 9 | // 10 | // Shell command: `grep `. 11 | func (s Stream) Grep(re *regexp.Regexp) Stream { 12 | return s.Modify(Grep{Re: re}) 13 | } 14 | 15 | // Grep is a modifier that filters only line that match `Re`. If Invert was set only line that did 16 | // not match the regex will be returned. 17 | // 18 | // Usage: 19 | // 20 | // ().Modify(script.Grep{Re: }) 21 | // 22 | // Shell command: `grep [-v ] `. 23 | type Grep struct { 24 | Re *regexp.Regexp 25 | Inverse bool 26 | } 27 | 28 | func (g Grep) Modify(line []byte) (modifed []byte, err error) { 29 | if line == nil { 30 | return nil, nil 31 | } 32 | if g.Re.Match(line) != g.Inverse { 33 | return append(line, '\n'), nil 34 | } 35 | return nil, nil 36 | } 37 | 38 | func (g Grep) Name() string { 39 | return fmt.Sprintf("grep(%v, invert=%v)", g.Re, g.Inverse) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/posener/script/sort.go: -------------------------------------------------------------------------------- 1 | package script 2 | 3 | import ( 4 | "bufio" 5 | "errors" 6 | "fmt" 7 | "sort" 8 | "strings" 9 | ) 10 | 11 | // Sort returns a stream with lines ordered alphabetically. 12 | // 13 | // Shell command: `wc`. 14 | func (s Stream) Sort(reverse bool) Stream { 15 | var ( 16 | lines []string 17 | merr error 18 | ) 19 | scanner := bufio.NewScanner(s.r) 20 | for scanner.Scan() { 21 | lines = append(lines, scanner.Text()) 22 | } 23 | if err := scanner.Err(); err != nil { 24 | merr = errors.Join(merr, fmt.Errorf("scanning stream: %w", err)) 25 | } 26 | 27 | sort.Slice(lines, func(i, j int) bool { return (lines[i] < lines[j]) != reverse }) 28 | 29 | var out strings.Builder 30 | for _, line := range lines { 31 | _, err := out.WriteString(line + "\n") 32 | if err != nil { 33 | merr = errors.Join(merr, fmt.Errorf("writing line %q: %w", line, err)) 34 | } 35 | } 36 | 37 | return Stream{ 38 | stage: fmt.Sprintf("sort(%v)", reverse), 39 | r: strings.NewReader(out.String()), 40 | err: merr, 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | 3 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: go 4 | 5 | go: 6 | - 1.9.x 7 | - 1.10.x 8 | - 1.11.x 9 | - tip 10 | 11 | matrix: 12 | allow_failures: 13 | - go: tip 14 | 15 | install: 16 | - go get golang.org/x/lint/golint 17 | - export PATH=$GOPATH/bin:$PATH 18 | - go install ./... 19 | 20 | script: 21 | - verify/all.sh -v 22 | - go test ./... 23 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go: -------------------------------------------------------------------------------- 1 | //go:build go1.17 2 | // +build go1.17 3 | 4 | // TODO: once support for Go 1.16 is dropped, this file can be 5 | // merged/removed with assertion_compare_go1.17_test.go and 6 | // assertion_compare_legacy.go 7 | 8 | package assert 9 | 10 | import "reflect" 11 | 12 | // Wrapper around reflect.Value.CanConvert, for compatibility 13 | // reasons. 14 | func canConvert(value reflect.Value, to reflect.Type) bool { 15 | return value.CanConvert(to) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.17 2 | // +build !go1.17 3 | 4 | // TODO: once support for Go 1.16 is dropped, this file can be 5 | // merged/removed with assertion_compare_go1.17_test.go and 6 | // assertion_compare_can_convert.go 7 | 8 | package assert 9 | 10 | import "reflect" 11 | 12 | // Older versions of Go does not have the reflect.Value.CanConvert 13 | // method. 14 | func canConvert(value reflect.Value, to reflect.Type) bool { 15 | return false 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentFormat}} 2 | func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" 17 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/.gitignore: -------------------------------------------------------------------------------- 1 | *.prof 2 | *.test 3 | *.swp 4 | /bin/ 5 | cover.out 6 | /.idea 7 | *.iml 8 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: go.etcd.io/bbolt 3 | 4 | sudo: false 5 | 6 | go: 7 | - 1.15 8 | 9 | before_install: 10 | - go get -v golang.org/x/sys/unix 11 | - go get -v honnef.co/go/tools/... 12 | - go get -v github.com/kisielk/errcheck 13 | 14 | script: 15 | - make fmt 16 | - make test 17 | - make race 18 | # - make errcheck 19 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_386.go: -------------------------------------------------------------------------------- 1 | package bbolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0x7FFFFFFF // 2GB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0xFFFFFFF 8 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_amd64.go: -------------------------------------------------------------------------------- 1 | package bbolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0x7FFFFFFF 8 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_arm.go: -------------------------------------------------------------------------------- 1 | package bbolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0x7FFFFFFF // 2GB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0xFFFFFFF 8 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_arm64.go: -------------------------------------------------------------------------------- 1 | // +build arm64 2 | 3 | package bbolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_linux.go: -------------------------------------------------------------------------------- 1 | package bbolt 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | // fdatasync flushes written data to a file descriptor. 8 | func fdatasync(db *DB) error { 9 | return syscall.Fdatasync(int(db.file.Fd())) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_mips64x.go: -------------------------------------------------------------------------------- 1 | // +build mips64 mips64le 2 | 3 | package bbolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0x8000000000 // 512GB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_mipsx.go: -------------------------------------------------------------------------------- 1 | // +build mips mipsle 2 | 3 | package bbolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0x40000000 // 1GB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0xFFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_openbsd.go: -------------------------------------------------------------------------------- 1 | package bbolt 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | const ( 9 | msAsync = 1 << iota // perform asynchronous writes 10 | msSync // perform synchronous writes 11 | msInvalidate // invalidate cached data 12 | ) 13 | 14 | func msync(db *DB) error { 15 | _, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(unsafe.Pointer(db.data)), uintptr(db.datasz), msInvalidate) 16 | if errno != 0 { 17 | return errno 18 | } 19 | return nil 20 | } 21 | 22 | func fdatasync(db *DB) error { 23 | if db.data != nil { 24 | return msync(db) 25 | } 26 | return db.file.Sync() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_ppc.go: -------------------------------------------------------------------------------- 1 | // +build ppc 2 | 3 | package bbolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0x7FFFFFFF // 2GB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0xFFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_ppc64.go: -------------------------------------------------------------------------------- 1 | // +build ppc64 2 | 3 | package bbolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_ppc64le.go: -------------------------------------------------------------------------------- 1 | // +build ppc64le 2 | 3 | package bbolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_riscv64.go: -------------------------------------------------------------------------------- 1 | // +build riscv64 2 | 3 | package bbolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/bolt_s390x.go: -------------------------------------------------------------------------------- 1 | // +build s390x 2 | 3 | package bbolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/boltsync_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!plan9,!linux,!openbsd 2 | 3 | package bbolt 4 | 5 | // fdatasync flushes written data to a file descriptor. 6 | func fdatasync(db *DB) error { 7 | return db.file.Sync() 8 | } 9 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/mlock_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package bbolt 4 | 5 | import "golang.org/x/sys/unix" 6 | 7 | // mlock locks memory of db file 8 | func mlock(db *DB, fileSize int) error { 9 | sizeToLock := fileSize 10 | if sizeToLock > db.datasz { 11 | // Can't lock more than mmaped slice 12 | sizeToLock = db.datasz 13 | } 14 | if err := unix.Mlock(db.dataref[:sizeToLock]); err != nil { 15 | return err 16 | } 17 | return nil 18 | } 19 | 20 | //munlock unlocks memory of db file 21 | func munlock(db *DB, fileSize int) error { 22 | if db.dataref == nil { 23 | return nil 24 | } 25 | 26 | sizeToUnlock := fileSize 27 | if sizeToUnlock > db.datasz { 28 | // Can't unlock more than mmaped slice 29 | sizeToUnlock = db.datasz 30 | } 31 | 32 | if err := unix.Munlock(db.dataref[:sizeToUnlock]); err != nil { 33 | return err 34 | } 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/go.etcd.io/bbolt/mlock_windows.go: -------------------------------------------------------------------------------- 1 | package bbolt 2 | 3 | // mlock locks memory of db file 4 | func mlock(_ *DB, _ int) error { 5 | panic("mlock is supported only on UNIX systems") 6 | } 7 | 8 | //munlock unlocks memory of db file 9 | func munlock(_ *DB, _ int) error { 10 | panic("munlock is supported only on UNIX systems") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/go4.org/netipx/.gitignore: -------------------------------------------------------------------------------- 1 | crashers 2 | suppressions 3 | netaddr-fuzz.zip 4 | -------------------------------------------------------------------------------- /vendor/go4.org/netipx/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "corpus"] 2 | path = corpus 3 | url = https://github.com/inetaf/netaddr-corpus.git 4 | -------------------------------------------------------------------------------- /vendor/go4.org/netipx/AUTHORS: -------------------------------------------------------------------------------- 1 | Alex Willmer 2 | Matt Layher 3 | Tailscale Inc. 4 | Tobias Klauser 5 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/idna/go118.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | // Copyright 2021 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | //go:build go1.18 8 | 9 | package idna 10 | 11 | // Transitional processing is disabled by default in Go 1.18. 12 | // https://golang.org/issue/47510 13 | const transitionalLookup = false 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/idna/pre_go118.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | // Copyright 2021 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | //go:build !go1.18 8 | 9 | package idna 10 | 11 | const transitionalLookup = true 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/idna/trie12.0.0.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | // Copyright 2016 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | //go:build !go1.16 8 | 9 | package idna 10 | 11 | // appendMapping appends the mapping for the respective rune. isMapped must be 12 | // true. A mapping is a categorization of a rune as defined in UTS #46. 13 | func (c info) appendMapping(b []byte, s string) []byte { 14 | index := int(c >> indexShift) 15 | if c&xorBit == 0 { 16 | s := mappings[index:] 17 | return append(b, s[1:s[0]+1]...) 18 | } 19 | b = append(b, s...) 20 | if c&inlineXOR == inlineXOR { 21 | // TODO: support and handle two-byte inline masks 22 | b[len(b)-1] ^= byte(index) 23 | } else { 24 | for p := len(b) - int(xorData[index]); p < len(b); p++ { 25 | index++ 26 | b[p] ^= xorData[index] 27 | } 28 | } 29 | return b 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/idna/trie13.0.0.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | // Copyright 2016 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | //go:build go1.16 8 | 9 | package idna 10 | 11 | // appendMapping appends the mapping for the respective rune. isMapped must be 12 | // true. A mapping is a categorization of a rune as defined in UTS #46. 13 | func (c info) appendMapping(b []byte, s string) []byte { 14 | index := int(c >> indexShift) 15 | if c&xorBit == 0 { 16 | p := index 17 | return append(b, mappings[mappingIndex[p]:mappingIndex[p+1]]...) 18 | } 19 | b = append(b, s...) 20 | if c&inlineXOR == inlineXOR { 21 | // TODO: support and handle two-byte inline masks 22 | b[len(b)-1] ^= byte(index) 23 | } else { 24 | for p := len(b) - int(xorData[index]); p < len(b); p++ { 25 | index++ 26 | b[p] ^= xorData[index] 27 | } 28 | } 29 | return b 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sync/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sync/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/asm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·use(SB),NOSPLIT,$0 8 | RET 9 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/asm_plan9_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | // 8 | // System call support for 386, Plan 9 9 | // 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-32 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-44 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 21 | JMP syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 24 | JMP syscall·RawSyscall6(SB) 25 | 26 | TEXT ·seek(SB),NOSPLIT,$0-36 27 | JMP syscall·seek(SB) 28 | 29 | TEXT ·exit(SB),NOSPLIT,$4-4 30 | JMP syscall·exit(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | // 8 | // System call support for amd64, Plan 9 9 | // 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-64 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | JMP syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | JMP syscall·RawSyscall6(SB) 25 | 26 | TEXT ·seek(SB),NOSPLIT,$0-56 27 | JMP syscall·seek(SB) 28 | 29 | TEXT ·exit(SB),NOSPLIT,$8-8 30 | JMP syscall·exit(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/asm_plan9_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | // System call support for plan9 on arm 8 | 9 | // Just jump to package syscall's implementation for all these functions. 10 | // The runtime may know about them. 11 | 12 | TEXT ·Syscall(SB),NOSPLIT,$0-32 13 | JMP syscall·Syscall(SB) 14 | 15 | TEXT ·Syscall6(SB),NOSPLIT,$0-44 16 | JMP syscall·Syscall6(SB) 17 | 18 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 19 | JMP syscall·RawSyscall(SB) 20 | 21 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·RawSyscall6(SB) 23 | 24 | TEXT ·seek(SB),NOSPLIT,$0-36 25 | JMP syscall·exit(SB) 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/env_plan9.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Plan 9 environment variables. 6 | 7 | package plan9 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | 6 | COMMAND="mksysnum_plan9.sh $@" 7 | 8 | cat <= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | type Signal = syscall.Signal 12 | type Errno = syscall.Errno 13 | type SysProcAttr = syscall.SysProcAttr 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 11 | // 12 | 13 | TEXT ·syscall6(SB),NOSPLIT,$0-88 14 | JMP syscall·syscall6(SB) 15 | 16 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSyscall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for 386 BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-28 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 21 | JMP syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 24 | JMP syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 27 | JMP syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for AMD64 BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 21 | JMP syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 24 | JMP syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 27 | JMP syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for ARM BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-28 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 21 | B syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 24 | B syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 27 | B syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for ARM64 BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 21 | JMP syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 24 | JMP syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 27 | JMP syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ppc64, BSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || freebsd || netbsd || openbsd) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // System call support for RISCV64 BSD 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 21 | JMP syscall·Syscall9(SB) 22 | 23 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 24 | JMP syscall·RawSyscall(SB) 25 | 26 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 27 | JMP syscall·RawSyscall6(SB) 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (ppc64 || ppc64le) && gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for ppc64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 17 | BL runtime·entersyscall(SB) 18 | MOVD a1+8(FP), R3 19 | MOVD a2+16(FP), R4 20 | MOVD a3+24(FP), R5 21 | MOVD R0, R6 22 | MOVD R0, R7 23 | MOVD R0, R8 24 | MOVD trap+0(FP), R9 // syscall entry 25 | SYSCALL R9 26 | MOVD R3, r1+32(FP) 27 | MOVD R4, r2+40(FP) 28 | BL runtime·exitsyscall(SB) 29 | RET 30 | 31 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 32 | MOVD a1+8(FP), R3 33 | MOVD a2+16(FP), R4 34 | MOVD a3+24(FP), R5 35 | MOVD R0, R6 36 | MOVD R0, R7 37 | MOVD R0, R8 38 | MOVD trap+0(FP), R9 // syscall entry 39 | SYSCALL R9 40 | MOVD R3, r1+32(FP) 41 | MOVD R4, r2+40(FP) 42 | RET 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for mips64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gc 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | HCI_CHANNEL_LOGGING = 4 27 | ) 28 | 29 | // Socketoption Level 30 | const ( 31 | SOL_BLUETOOTH = 0x112 32 | SOL_HCI = 0x0 33 | SOL_L2CAP = 0x6 34 | SOL_RFCOMM = 0x12 35 | SOL_SCO = 0x11 36 | ) 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix && ppc 6 | 7 | // Functions to access/create device major and minor numbers matching the 8 | // encoding used by AIX. 9 | 10 | package unix 11 | 12 | // Major returns the major component of a Linux device number. 13 | func Major(dev uint64) uint32 { 14 | return uint32((dev >> 16) & 0xffff) 15 | } 16 | 17 | // Minor returns the minor component of a Linux device number. 18 | func Minor(dev uint64) uint32 { 19 | return uint32(dev & 0xffff) 20 | } 21 | 22 | // Mkdev returns a Linux device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | return uint64(((major) << 16) | (minor)) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix && ppc64 6 | 7 | // Functions to access/create device major and minor numbers matching the 8 | // encoding used AIX. 9 | 10 | package unix 11 | 12 | // Major returns the major component of a Linux device number. 13 | func Major(dev uint64) uint32 { 14 | return uint32((dev & 0x3fffffff00000000) >> 32) 15 | } 16 | 17 | // Minor returns the minor component of a Linux device number. 18 | func Minor(dev uint64) uint32 { 19 | return uint32((dev & 0x00000000ffffffff) >> 0) 20 | } 21 | 22 | // Mkdev returns a Linux device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | var DEVNO64 uint64 26 | DEVNO64 = 0x8000000000000000 27 | return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_zos.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build zos && s390x 6 | 7 | // Functions to access/create device major and minor numbers matching the 8 | // encoding used by z/OS. 9 | // 10 | // The information below is extracted and adapted from macros. 11 | 12 | package unix 13 | 14 | // Major returns the major component of a z/OS device number. 15 | func Major(dev uint64) uint32 { 16 | return uint32((dev >> 16) & 0x0000FFFF) 17 | } 18 | 19 | // Minor returns the minor component of a z/OS device number. 20 | func Minor(dev uint64) uint32 { 21 | return uint32(dev & 0x0000FFFF) 22 | } 23 | 24 | // Mkdev returns a z/OS device number generated from the given major and minor 25 | // components. 26 | func Mkdev(major, minor uint32) uint64 { 27 | return (uint64(major) << 16) | uint64(minor) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import "unsafe" 8 | 9 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 10 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 11 | return fcntl(int(fd), cmd, arg) 12 | } 13 | 14 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 15 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 16 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) 17 | return err 18 | } 19 | 20 | // FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command. 21 | func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error { 22 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore)))) 23 | return err 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc) 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fdset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos 6 | 7 | package unix 8 | 9 | // Set adds fd to the set fds. 10 | func (fds *FdSet) Set(fd int) { 11 | fds.Bits[fd/NFDBITS] |= (1 << (uintptr(fd) % NFDBITS)) 12 | } 13 | 14 | // Clear removes fd from the set fds. 15 | func (fds *FdSet) Clear(fd int) { 16 | fds.Bits[fd/NFDBITS] &^= (1 << (uintptr(fd) % NFDBITS)) 17 | } 18 | 19 | // IsSet returns whether fd is in the set fds. 20 | func (fds *FdSet) IsSet(fd int) bool { 21 | return fds.Bits[fd/NFDBITS]&(1<<(uintptr(fd)%NFDBITS)) != 0 22 | } 23 | 24 | // Zero clears the set fds. 25 | func (fds *FdSet) Zero() { 26 | for i := range fds.Bits { 27 | fds.Bits[i] = 0 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gccgo && linux && amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mmap_nomremap.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || openbsd || solaris 6 | 7 | package unix 8 | 9 | var mapper = &mmapper{ 10 | active: make(map[*byte][]byte), 11 | mmap: mmap, 12 | munmap: munmap, 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ptrace_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin && !ios 6 | 7 | package unix 8 | 9 | func ptrace(request int, pid int, addr uintptr, data uintptr) error { 10 | return ptrace1(request, pid, addr, data) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ptrace_ios.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ios 6 | 7 | package unix 8 | 9 | func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { 10 | return ENOTSUP 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin && race) || (linux && race) || (freebsd && race) 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdents.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || dragonfly || freebsd || linux || netbsd || openbsd 6 | 7 | package unix 8 | 9 | // ReadDirent reads directory entries from fd and writes them into buf. 10 | func ReadDirent(fd int, buf []byte) (n int, err error) { 11 | return Getdents(fd, buf) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdirentries.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // ReadDirent reads directory entries from fd and writes them into buf. 12 | func ReadDirent(fd int, buf []byte) (n int, err error) { 13 | // Final argument is (basep *uintptr) and the syscall doesn't take nil. 14 | // 64 bits should be enough. (32 bits isn't even on 386). Since the 15 | // actual system call is getdirentries64, 64 is a good guess. 16 | // TODO(rsc): Can we use a single global basep for all calls? 17 | var base = (*uintptr)(unsafe.Pointer(new(uint64))) 18 | return Getdirentries(fd, buf, base) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | // Round the length of a raw sockaddr up to align it properly. 8 | func cmsgAlignOf(salen int) int { 9 | salign := SizeofPtr 10 | if SizeofPtr == 8 && !supportsABI(_dragonflyABIChangeVersion) { 11 | // 64-bit Dragonfly before the September 2019 ABI changes still requires 12 | // 32-bit aligned access to network subsystem. 13 | salign = 4 14 | } 15 | return (salen + salign - 1) & ^(salign - 1) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_hurd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build hurd 6 | 7 | package unix 8 | 9 | /* 10 | #include 11 | int ioctl(int, unsigned long int, uintptr_t); 12 | */ 13 | import "C" 14 | 15 | func ioctl(fd int, req uint, arg uintptr) (err error) { 16 | r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg)) 17 | if r0 == -1 && er != nil { 18 | err = er 19 | } 20 | return 21 | } 22 | 23 | func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { 24 | r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(uintptr(arg))) 25 | if r0 == -1 && er != nil { 26 | err = er 27 | } 28 | return 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_hurd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 && hurd 6 | 7 | package unix 8 | 9 | const ( 10 | TIOCGETA = 0x62251713 11 | ) 12 | 13 | type Winsize struct { 14 | Row uint16 15 | Col uint16 16 | Xpixel uint16 17 | Ypixel uint16 18 | } 19 | 20 | type Termios struct { 21 | Iflag uint32 22 | Oflag uint32 23 | Cflag uint32 24 | Lflag uint32 25 | Cc [20]uint8 26 | Ispeed int32 27 | Ospeed int32 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_alarm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64) 6 | 7 | package unix 8 | 9 | // SYS_ALARM is not defined on arm or riscv, but is available for other GOARCH 10 | // values. 11 | 12 | //sys Alarm(seconds uint) (remaining uint, err error) 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && linux && gc 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //go:noescape 12 | func gettimeofday(tv *Timeval) (err syscall.Errno) 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gc 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gc && 386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm && gc && linux 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && gccgo && arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 && netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm && netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 && netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build amd64 && solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (msghdr *Msghdr) SetIovlen(length int) { 22 | msghdr.Iovlen = int32(length) 23 | } 24 | 25 | func (cmsg *Cmsghdr) SetLen(length int) { 26 | cmsg.Len = uint32(length) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 12 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux && (ppc64le || ppc64) && gc 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 12 | return syscall.Syscall(trap, a1, a2, a3) 13 | } 14 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 15 | return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) 16 | } 17 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | return syscall.RawSyscall(trap, a1, a2, a3) 19 | } 20 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 21 | return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sysvshm_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build linux 6 | 7 | package unix 8 | 9 | import "runtime" 10 | 11 | // SysvShmCtl performs control operations on the shared memory segment 12 | // specified by id. 13 | func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { 14 | if runtime.GOARCH == "arm" || 15 | runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { 16 | cmd |= ipc_64 17 | } 18 | 19 | return shmctl(id, cmd, desc) 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sysvshm_unix_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin && !ios 6 | 7 | package unix 8 | 9 | // SysvShmCtl performs control operations on the shared memory segment 10 | // specified by id. 11 | func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { 12 | return shmctl(id, cmd, desc) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtraceRegSet("arm64"). DO NOT EDIT. 2 | 3 | package unix 4 | 5 | import "unsafe" 6 | 7 | // PtraceGetRegSetArm64 fetches the registers used by arm64 binaries. 8 | func PtraceGetRegSetArm64(pid, addr int, regsout *PtraceRegsArm64) error { 9 | iovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))} 10 | return ptracePtr(PTRACE_GETREGSET, pid, uintptr(addr), unsafe.Pointer(&iovec)) 11 | } 12 | 13 | // PtraceSetRegSetArm64 sets the registers used by arm64 binaries. 14 | func PtraceSetRegSetArm64(pid, addr int, regs *PtraceRegsArm64) error { 15 | iovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))} 16 | return ptracePtr(PTRACE_SETREGSET, pid, uintptr(addr), unsafe.Pointer(&iovec)) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build windows && go1.9 6 | 7 | package windows 8 | 9 | import "syscall" 10 | 11 | type Errno = syscall.Errno 12 | type SysProcAttr = syscall.SysProcAttr 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/empty.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.12 6 | 7 | // This file is here to allow bodyless functions with go:linkname for Go 1.11 8 | // and earlier (see https://golang.org/issue/23311). 9 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/eventlog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build windows 6 | 7 | package windows 8 | 9 | const ( 10 | EVENTLOG_SUCCESS = 0 11 | EVENTLOG_ERROR_TYPE = 1 12 | EVENTLOG_WARNING_TYPE = 2 13 | EVENTLOG_INFORMATION_TYPE = 4 14 | EVENTLOG_AUDIT_SUCCESS = 8 15 | EVENTLOG_AUDIT_FAILURE = 16 16 | ) 17 | 18 | //sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW 19 | //sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource 20 | //sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mksyscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build generate 6 | 7 | package windows 8 | 9 | //go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go setupapi_windows.go 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build windows && race 6 | 7 | package windows 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build windows && !race 6 | 7 | package windows 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build windows 6 | 7 | package windows 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + itoa(-val) 12 | } 13 | var buf [32]byte // big enough for int64 14 | i := len(buf) - 1 15 | for val >= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | 24 | type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { 25 | PerProcessUserTimeLimit int64 26 | PerJobUserTimeLimit int64 27 | LimitFlags uint32 28 | MinimumWorkingSetSize uintptr 29 | MaximumWorkingSetSize uintptr 30 | ActiveProcessLimit uint32 31 | Affinity uintptr 32 | PriorityClass uint32 33 | SchedulingClass uint32 34 | _ uint32 // pad to 8 byte boundary 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | 24 | type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { 25 | PerProcessUserTimeLimit int64 26 | PerJobUserTimeLimit int64 27 | LimitFlags uint32 28 | MinimumWorkingSetSize uintptr 29 | MaximumWorkingSetSize uintptr 30 | ActiveProcessLimit uint32 31 | Affinity uintptr 32 | PriorityClass uint32 33 | SchedulingClass uint32 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | 24 | type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { 25 | PerProcessUserTimeLimit int64 26 | PerJobUserTimeLimit int64 27 | LimitFlags uint32 28 | MinimumWorkingSetSize uintptr 29 | MaximumWorkingSetSize uintptr 30 | ActiveProcessLimit uint32 31 | Affinity uintptr 32 | PriorityClass uint32 33 | SchedulingClass uint32 34 | _ uint32 // pad to 8 byte boundary 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | 24 | type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { 25 | PerProcessUserTimeLimit int64 26 | PerJobUserTimeLimit int64 27 | LimitFlags uint32 28 | MinimumWorkingSetSize uintptr 29 | MaximumWorkingSetSize uintptr 30 | ActiveProcessLimit uint32 31 | Affinity uintptr 32 | PriorityClass uint32 33 | SchedulingClass uint32 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/term/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Go 2 | 3 | Go is an open source project. 4 | 5 | It is the work of hundreds of contributors. We appreciate your help! 6 | 7 | ## Filing issues 8 | 9 | When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: 10 | 11 | 1. What version of Go are you using (`go version`)? 12 | 2. What operating system and processor architecture are you using? 13 | 3. What did you do? 14 | 4. What did you expect to see? 15 | 5. What did you see instead? 16 | 17 | General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. 18 | The gophers there will answer or ask you to file an issue if you've tripped over a bug. 19 | 20 | ## Contributing code 21 | 22 | Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) 23 | before sending patches. 24 | 25 | Unless otherwise noted, the Go source files are distributed under 26 | the BSD-style license found in the LICENSE file. 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/term/README.md: -------------------------------------------------------------------------------- 1 | # Go terminal/console support 2 | 3 | [![Go Reference](https://pkg.go.dev/badge/golang.org/x/term.svg)](https://pkg.go.dev/golang.org/x/term) 4 | 5 | This repository provides Go terminal and console support packages. 6 | 7 | ## Download/Install 8 | 9 | The easiest way to install is to run `go get -u golang.org/x/term`. You can 10 | also manually git clone the repository to `$GOPATH/src/golang.org/x/term`. 11 | 12 | ## Report Issues / Send Patches 13 | 14 | This repository uses Gerrit for code changes. To learn how to submit changes to 15 | this repository, see https://golang.org/doc/contribute.html. 16 | 17 | The main issue tracker for the term repository is located at 18 | https://github.com/golang/go/issues. Prefix your issue with "x/term:" in the 19 | subject line, so it is easy to find. 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/term/codereview.cfg: -------------------------------------------------------------------------------- 1 | issuerepo: golang/go 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/term/term_unix_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build darwin || dragonfly || freebsd || netbsd || openbsd 6 | 7 | package term 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const ioctlReadTermios = unix.TIOCGETA 12 | const ioctlWriteTermios = unix.TIOCSETA 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/term/term_unix_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || linux || solaris || zos 6 | 7 | package term 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const ioctlReadTermios = unix.TCGETS 12 | const ioctlWriteTermios = unix.TCSETS 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.10 6 | 7 | package bidirule 8 | 9 | func (t *Transformer) isFinal() bool { 10 | return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.10 6 | 7 | package bidirule 8 | 9 | func (t *Transformer) isFinal() bool { 10 | if !t.isRTL() { 11 | return true 12 | } 13 | return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial 14 | } 15 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | --------------------------------------------------------------------------------