Advertise tailnet and public routes in server discovery
The mDNS record now carries ts= (tailnet IPv4 addresses) and public= (the installer's HTTPS origin from PIPELINES_WEB_PUBLIC_URL) in TXT, and browse, the discover_servers RPC and /discovery return every route to a machine as addresses with kinds lan, tailscale and public. Endpoint stays the LAN route for older clients. Unsafe ts/public values are dropped.
This commit is contained in:
@@ -15,8 +15,11 @@ import (
|
||||
// The returned stop (nil when nothing was published) withdraws the advert.
|
||||
func advertise(addr string, proxyPort int) func() {
|
||||
hostname, _ := os.Hostname()
|
||||
// The installer exports the TLS front's origin (tailscale serve) for the
|
||||
// same proxy; it is advertised so clients can choose that route by name.
|
||||
advert, err := discovery.Plan(discovery.Config{ListenAddr: addr, ProxyPort: proxyPort,
|
||||
Version: buildinfo.Current().Version, Hostname: hostname, IPs: discovery.LANAddresses()})
|
||||
Version: buildinfo.Current().Version, Hostname: hostname, IPs: discovery.LANAddresses(),
|
||||
TailscaleIPs: discovery.TailscaleAddresses(), PublicURL: os.Getenv("PIPELINES_WEB_PUBLIC_URL")})
|
||||
if err != nil {
|
||||
log.Printf("mDNS: not advertising: %v", err)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user