dip/vendor/github.com/likexian/whois/README.md

91 lines
2.0 KiB
Markdown
Raw Normal View History

2020-05-24 18:42:01 +02:00
# Whois
2019-12-22 18:20:45 +01:00
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
2021-11-12 12:28:10 +01:00
[![GoDoc](https://pkg.go.dev/badge/github.com/likexian/whois.svg)](https://pkg.go.dev/github.com/likexian/whois)
[![Go Report Card](https://goreportcard.com/badge/github.com/likexian/whois)](https://goreportcard.com/report/github.com/likexian/whois)
[![Build Status](https://github.com/likexian/whois/actions/workflows/gotest.yaml/badge.svg)](https://github.com/likexian/whois/actions/workflows/gotest.yaml)
[![Code Cover](https://release.likexian.com/whois/coverage.svg)](https://github.com/likexian/whois/actions/workflows/gotest.yaml)
2019-12-22 18:20:45 +01:00
2020-05-24 18:42:01 +02:00
Whois is a simple Go module for domain and ip whois information query.
2019-12-22 18:20:45 +01:00
## Overview
2021-11-12 12:28:10 +01:00
All of domain, IP include IPv4 and IPv6, ASN are supported.
2019-12-22 18:20:45 +01:00
2020-05-24 18:42:01 +02:00
You can directly using the binary distributions whois, follow [whois release tool](cmd/whois).
2019-12-22 18:20:45 +01:00
2020-05-24 18:42:01 +02:00
Or you can do development by using this golang module as below.
2019-12-22 18:20:45 +01:00
## Installation
2020-05-24 18:42:01 +02:00
```shell
2021-11-12 12:28:10 +01:00
go get -u github.com/likexian/whois
2020-05-24 18:42:01 +02:00
```
2019-12-22 18:20:45 +01:00
## Importing
2020-05-24 18:42:01 +02:00
```go
import (
2021-11-12 12:28:10 +01:00
"github.com/likexian/whois"
2020-05-24 18:42:01 +02:00
)
```
2019-12-22 18:20:45 +01:00
## Documentation
2021-11-12 12:28:10 +01:00
Visit the docs on [GoDoc](https://pkg.go.dev/github.com/likexian/whois)
2019-12-22 18:20:45 +01:00
## Example
### whois query for domain
```go
2020-05-24 18:42:01 +02:00
result, err := whois.Whois("likexian.com")
2019-12-22 18:20:45 +01:00
if err == nil {
fmt.Println(result)
}
```
2021-11-12 12:28:10 +01:00
### whois query for IPv6
2020-05-24 18:42:01 +02:00
```go
result, err := whois.Whois("2001:dc7::1")
if err == nil {
fmt.Println(result)
}
```
2021-11-12 12:28:10 +01:00
### whois query for IPv4
2019-12-22 18:20:45 +01:00
```go
result, err := whois.Whois("1.1.1.1")
if err == nil {
fmt.Println(result)
}
```
2021-11-12 12:28:10 +01:00
### whois query for ASN
```go
// or whois.Whois("AS60614")
result, err := whois.Whois("60614")
if err == nil {
fmt.Println(result)
}
```
2020-05-24 18:42:01 +02:00
## Whois information parsing
2019-12-22 18:20:45 +01:00
2021-11-12 12:28:10 +01:00
Please refer to [whois-parser](https://github.com/likexian/whois-parser)
2019-12-22 18:20:45 +01:00
2020-05-24 18:42:01 +02:00
## License
2019-12-22 18:20:45 +01:00
Copyright 2014-2022 [Li Kexian](https://www.likexian.com/)
2019-12-22 18:20:45 +01:00
Licensed under the Apache License 2.0
2020-05-24 18:42:01 +02:00
## Donation
2019-12-22 18:20:45 +01:00
2020-05-24 18:42:01 +02:00
If this project is helpful, please share it with friends.
2019-12-22 18:20:45 +01:00
2020-05-24 18:42:01 +02:00
If you want to thank me, you can [give me a cup of coffee](https://www.likexian.com/donate/).