ipn/conf: add ConfigVAlpha.AdvertiseExitNode
Fixes #19941 Change-Id: I69e63a8036f50cfee2ed770a88f92ce344412f4d Signed-off-by: scientificworld <scientificworld@users.noreply.github.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
6fdffd9e5e
commit
16f600df8c
+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"`
|
||||
|
||||
@@ -124,6 +126,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