mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-27 02:37:38 +00:00
code review feedback
Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
parent
3748046455
commit
981c2fa5fd
@ -626,7 +626,7 @@ func (b *LocalBackend) SetDirectFileRoot(dir string) {
|
|||||||
// success, or (false, error) on failure.
|
// success, or (false, error) on failure.
|
||||||
//
|
//
|
||||||
// If it is called whilst the LocalBackend is in 'Running' state, only a subset
|
// If it is called whilst the LocalBackend is in 'Running' state, only a subset
|
||||||
// of changes currently deemed safe to chnage for a running system are applied.
|
// of changes currently deemed safe to change for a running system are applied.
|
||||||
// The rest of the changes will get applied next time LocalBackend starts and
|
// The rest of the changes will get applied next time LocalBackend starts and
|
||||||
// config is reloaded. Currently (08/2024) changes safe to apply while running
|
// config is reloaded. Currently (08/2024) changes safe to apply while running
|
||||||
// are changes to '.AcceptRoutes', '.AdvertiseRoutes' and '.StaticEndpoints'
|
// are changes to '.AcceptRoutes', '.AdvertiseRoutes' and '.StaticEndpoints'
|
||||||
@ -705,8 +705,7 @@ func (b *LocalBackend) setConfigLocked(conf *conffile.Config, unlock unlockOnce)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// needStaticEndpointUpdate accepts a configfile and returns true if the
|
// needStaticEndpointUpdate reports whether newConf modifies the static wireguard endpoints.
|
||||||
// configfile contains a change to the static wireguard endpoints.
|
|
||||||
func (b *LocalBackend) needStaticEndpointsUpdate(newConf *conffile.Config) bool {
|
func (b *LocalBackend) needStaticEndpointsUpdate(newConf *conffile.Config) bool {
|
||||||
// If the new configfile does not have static endpoints set and existing
|
// If the new configfile does not have static endpoints set and existing
|
||||||
// config does not have any (to unset), no need to update.
|
// config does not have any (to unset), no need to update.
|
||||||
|
@ -645,7 +645,7 @@ func (c *Conn) setEndpoints(endpoints []tailcfg.Endpoint) (changed bool) {
|
|||||||
|
|
||||||
// SetStaticEndpoints sets static endpoints to the provided value and triggers
|
// SetStaticEndpoints sets static endpoints to the provided value and triggers
|
||||||
// an asynchronous update of the endpoints that this node advertises.
|
// an asynchronous update of the endpoints that this node advertises.
|
||||||
// Static endpoints are endpoints explicitly configured by user.
|
// Static endpoints are endpoints explicitly configured by the user.
|
||||||
func (c *Conn) SetStaticEndpoints(ep views.Slice[netip.AddrPort]) {
|
func (c *Conn) SetStaticEndpoints(ep views.Slice[netip.AddrPort]) {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
if reflect.DeepEqual(c.staticEndpoints.AsSlice(), ep.AsSlice()) {
|
if reflect.DeepEqual(c.staticEndpoints.AsSlice(), ep.AsSlice()) {
|
||||||
@ -659,8 +659,10 @@ func (c *Conn) SetStaticEndpoints(ep views.Slice[netip.AddrPort]) {
|
|||||||
c.ReSTUN("static-endpoint-change")
|
c.ReSTUN("static-endpoint-change")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStaticEndpoints returns any wireguard endpoints explicitly configured by user.
|
// GetStaticEndpoints returns any wireguard endpoints explicitly configured by the user.
|
||||||
func (c *Conn) GetStaticEndpoints() views.Slice[netip.AddrPort] {
|
func (c *Conn) GetStaticEndpoints() views.Slice[netip.AddrPort] {
|
||||||
|
c.mu.Lock()
|
||||||
|
c.mu.Unlock()
|
||||||
return c.staticEndpoints
|
return c.staticEndpoints
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user