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"
|
"fmt"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
|
"tailscale.com/net/tsaddr"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/types/opt"
|
"tailscale.com/types/opt"
|
||||||
"tailscale.com/types/preftype"
|
"tailscale.com/types/preftype"
|
||||||
@@ -31,8 +32,9 @@ type ConfigVAlpha struct {
|
|||||||
ExitNode *string `json:"exitNode,omitempty"` // IP, StableID, or MagicDNS base name
|
ExitNode *string `json:"exitNode,omitempty"` // IP, StableID, or MagicDNS base name
|
||||||
AllowLANWhileUsingExitNode opt.Bool `json:"allowLANWhileUsingExitNode,omitempty"`
|
AllowLANWhileUsingExitNode opt.Bool `json:"allowLANWhileUsingExitNode,omitempty"`
|
||||||
|
|
||||||
AdvertiseRoutes []netip.Prefix `json:",omitempty"`
|
AdvertiseRoutes []netip.Prefix `json:",omitempty"`
|
||||||
DisableSNAT opt.Bool `json:",omitempty"`
|
AdvertiseExitNode opt.Bool `json:",omitzero"`
|
||||||
|
DisableSNAT opt.Bool `json:",omitzero"`
|
||||||
|
|
||||||
AdvertiseServices []string `json:",omitempty"`
|
AdvertiseServices []string `json:",omitempty"`
|
||||||
|
|
||||||
@@ -124,6 +126,14 @@ func (c *ConfigVAlpha) ToPrefs() (MaskedPrefs, error) {
|
|||||||
mp.AdvertiseRoutes = c.AdvertiseRoutes
|
mp.AdvertiseRoutes = c.AdvertiseRoutes
|
||||||
mp.AdvertiseRoutesSet = true
|
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 != "" {
|
if c.DisableSNAT != "" {
|
||||||
mp.NoSNAT = c.DisableSNAT.EqualBool(true)
|
mp.NoSNAT = c.DisableSNAT.EqualBool(true)
|
||||||
mp.NoSNATSet = true
|
mp.NoSNATSet = true
|
||||||
|
|||||||
Reference in New Issue
Block a user