mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-26 03:26:26 -08:00
ipn/conf: add advertiseExitNode option
Closes #19941. Change-Id: I69e63a8036f50cfee2ed770a88f92ce344412f4d Signed-off-by: scientificworld <[email protected]>
This commit is contained in:
1 parent
a3bec699dc
commit
1b60a7d16c
1 file changed
+12
-2
+12
-2
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"net/netip"
|
||||
|
||||
"tailscale.com/net/tsaddr"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/types/opt"
|
||||
"tailscale.com/types/preftype"
|
||||
@@ -31,8 +32,9 @@ type ConfigVAlpha struct {
|
||||
ExitNode *string `json:"exitNode,omitempty"` // IP, StableID, or MagicDNS base name
|
||||
AllowLANWhileUsingExitNode opt.Bool `json:"allowLANWhileUsingExitNode,omitempty"`
|
||||
|
||||
AdvertiseRoutes []netip.Prefix `json:",omitempty"`
|
||||
DisableSNAT opt.Bool `json:",omitempty"`
|
||||
AdvertiseRoutes []netip.Prefix `json:",omitempty"`
|
||||
AdvertiseExitNode opt.Bool `json:",omitzero"`
|
||||
DisableSNAT opt.Bool `json:",omitzero"`
|
||||
|
||||
AdvertiseServices []string `json:",omitempty"`
|
||||
|
||||
@@ -115,6 +117,14 @@ func (c *ConfigVAlpha) ToPrefs() (MaskedPrefs, error) {
|
||||
mp.AdvertiseRoutes = c.AdvertiseRoutes
|
||||
mp.AdvertiseRoutesSet = true
|
||||
}
|
||||
if c.AdvertiseExitNode.EqualBool(true) {
|
||||
if mp.AdvertiseRoutesSet {
|
||||
mp.AdvertiseRoutes = append(mp.AdvertiseRoutes, tsaddr.AllIPv4(), tsaddr.AllIPv6())
|
||||
} else {
|
||||
mp.AdvertiseRoutes = tsaddr.ExitRoutes()
|
||||
mp.AdvertiseRoutesSet = true
|
||||
}
|
||||
}
|
||||
if c.DisableSNAT != "" {
|
||||
mp.NoSNAT = c.DisableSNAT.EqualBool(true)
|
||||
mp.NoSNATSet = true
|
||||
|
||||
Reference in new issue
Block a user