cmd/sniproxy: draw the rest of the DNS owl.
Add a DNS server which always responds as its own IP addresses. Additionally add a tsnet TailscaleIPs() function to return the IP addresses, both IPv4 and IPv6. Updates https://github.com/tailscale/tailscale/issues/1748 Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:

committed by
Denton Gentry

parent
7e6c5a2db4
commit
b46c5ae82a
@ -351,6 +351,24 @@ func (s *Server) doInit() {
|
||||
}
|
||||
}
|
||||
|
||||
// TailscaleIPs returns IPv4 and IPv6 addresses for this node. If the node
|
||||
// has not yet joined a tailnet or is otherwise unaware of its own IP addresses,
|
||||
// the returned ip4, ip6 will be !netip.IsValid().
|
||||
func (s *Server) TailscaleIPs() (ip4, ip6 netip.Addr) {
|
||||
nm := s.lb.NetMap()
|
||||
for _, addr := range nm.Addresses {
|
||||
ip := addr.Addr()
|
||||
if ip.Is6() {
|
||||
ip6 = ip
|
||||
}
|
||||
if ip.Is4() {
|
||||
ip4 = ip
|
||||
}
|
||||
}
|
||||
|
||||
return ip4, ip6
|
||||
}
|
||||
|
||||
func (s *Server) getAuthKey() string {
|
||||
if v := s.AuthKey; v != "" {
|
||||
return v
|
||||
|
Reference in New Issue
Block a user