Add Client.PublicIPs

This commit is contained in:
Matt Joiner 2022-06-22 23:59:18 +10:00
parent b232729e0c
commit 05cd58de85
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
1 changed files with 10 additions and 0 deletions

View File

@ -1590,6 +1590,16 @@ func (cl *Client) ListenAddrs() (ret []net.Addr) {
return
}
func (cl *Client) PublicIPs() (ips []net.IP) {
if ip := cl.config.PublicIp4; ip != nil {
ips = append(ips, ip)
}
if ip := cl.config.PublicIp6; ip != nil {
ips = append(ips, ip)
}
return
}
func (cl *Client) onBadAccept(addr PeerRemoteAddr) {
ipa, ok := tryIpPortFromNetAddr(addr)
if !ok {