You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
goip/README.md

39 lines
920 B

2 years ago
<h1>
<a href="https://www.dtapp.net/">Golang Ip</a>
</h1>
2 years ago
📦 Golang Ip
2 years ago
[comment]: <> (go)
2 years ago
[![godoc](https://pkg.go.dev/badge/go.dtapp.net/goip?status.svg)](https://pkg.go.dev/go.dtapp.net/goip)
[![goproxy.cn](https://goproxy.cn/stats/go.dtapp.net/goip/badges/download-count.svg)](https://goproxy.cn/stats/go.dtapp.net/goip)
[![goreportcard.com](https://goreportcard.com/badge/go.dtapp.net/goip )](https://goreportcard.com/report/go.dtapp.net/goip)
[![deps.dev](https://img.shields.io/badge/deps-go-red.svg)](https://deps.dev/go/go.dtapp.net%2Fgoip)
2 years ago
2 years ago
#### 安装
2 years ago
```go
2 years ago
go get -v -u go.dtapp.net/goip
2 years ago
```
2 years ago
#### 使用
2 years ago
```go
package main
import (
2 years ago
"context"
2 years ago
"go.dtapp.net/goip"
2 years ago
"testing"
)
func TestGoIp(t *testing.T) {
// 获取Mac地址
2 years ago
t.Log(goip.GetMacAddr(context.Background()))
2 years ago
// 内网ip
2 years ago
t.Log(goip.GetInsideIp(context.Background()))
2 years ago
// 外网ip
2 years ago
t.Log(goip.GetOutsideIp(context.Background()))
2 years ago
}
2 years ago
```