mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
Public IP endpoint with GET /ip fixing #319
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package publicip
|
||||
|
||||
import "net"
|
||||
|
||||
func (l *looper) GetPublicIP() (publicIP net.IP) {
|
||||
l.ipMutex.RLock()
|
||||
defer l.ipMutex.RUnlock()
|
||||
publicIP = make(net.IP, len(l.ip))
|
||||
copy(publicIP, l.ip)
|
||||
return publicIP
|
||||
}
|
||||
|
||||
func (l *looper) setPublicIP(publicIP net.IP) {
|
||||
l.ipMutex.Lock()
|
||||
defer l.ipMutex.Unlock()
|
||||
l.ip = publicIP
|
||||
}
|
||||
Reference in New Issue
Block a user