MCPcopy
hub / github.com/ccfos/nightingale / GetOutboundIP

Function GetOutboundIP

conf/conf.go:94–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92}
93
94func GetOutboundIP() net.IP {
95 conn, err := net.Dial("udp", "223.5.5.5:80")
96 if err != nil {
97 fmt.Println("auto get outbound ip fail:", err)
98 return []byte{}
99 }
100 defer conn.Close()
101
102 localAddr := conn.LocalAddr().(*net.UDPAddr)
103
104 return localAddr.IP
105}

Callers 1

InitConfigFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected