1
0
mirror of https://github.com/IceWhaleTech/CasaOS.git synced 2025-07-06 23:37:26 +02:00
Files
CasaOS/pkg/utils/ip_helper/ip_test.go

33 lines
549 B
Go
Raw Normal View History

2021-09-26 10:35:02 +08:00
package ip_helper
import (
"fmt"
2022-05-05 13:46:55 +08:00
"net"
2021-09-26 10:35:02 +08:00
"testing"
"go.uber.org/goleak"
2021-09-26 10:35:02 +08:00
)
func TestGetExternalIPV4(t *testing.T) {
goleak.VerifyNone(t)
2021-09-26 10:35:02 +08:00
ipv4 := make(chan string)
go func() { ipv4 <- GetExternalIPV4() }()
fmt.Println(<-ipv4)
}
2021-09-26 10:35:02 +08:00
func TestGetExternalIPV6(t *testing.T) {
ipv6 := make(chan string)
go func() { ipv6 <- GetExternalIPV6() }()
fmt.Println(<-ipv6)
}
func TestGetLoclIp(t *testing.T) {
fmt.Println(GetLoclIp())
}
2022-05-05 13:46:55 +08:00
func TestHasLocalIP(t *testing.T) {
fmt.Println("dddd")
fmt.Println(HasLocalIP(net.ParseIP("192.168.2.10")))
}