├── .gitignore ├── LICENSE ├── README.md └── whois.go /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 xiaoqidun 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # whois 2 | 一款跨平台的命令行whois查询工具 3 | # 快速安装 4 | go get -u github.com/xiaoqidun/whois 5 | # 编译安装 6 | ``` 7 | git clone https://github.com/xiaoqidun/whois.git 8 | cd whois 9 | go build whois.go 10 | ``` 11 | # 手动安装 12 | 1. 根据系统架构下载为你编译好的[二进制文件](https://github.com/xiaoqidun/whois/releases) 13 | 2. 将下载好的二进制文件重命名为whois并保留后缀 14 | 3. 把whois文件移动到系统PATH环境变量中的目录下 15 | 4. windows外的系统需使用chmod命令赋予可执行权限 16 | # 使用说明 17 | ```shell script 18 | whois aite.xyz 19 | ``` -------------------------------------------------------------------------------- /whois.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "io/ioutil" 6 | "net/http" 7 | "net/url" 8 | "os" 9 | ) 10 | 11 | func main() { 12 | if len(os.Args) < 2 { 13 | return 14 | } 15 | client := &http.Client{Transport: &http.Transport{ 16 | DisableKeepAlives: true, 17 | }} 18 | resp, err := client.Get("https://whois.aite.xyz/?ajax&client&domain=" + url.QueryEscape(os.Args[1])) 19 | if err != nil { 20 | return 21 | } 22 | defer resp.Body.Close() 23 | body, err := ioutil.ReadAll(resp.Body) 24 | if err != nil { 25 | return 26 | } 27 | fmt.Println(string(body)) 28 | } 29 | --------------------------------------------------------------------------------