code review feedback

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
Irbe Krumina 2024-08-05 19:45:35 +03:00
parent 3748046455
commit 981c2fa5fd
2 changed files with 6 additions and 5 deletions

View File

@ -626,7 +626,7 @@ func (b *LocalBackend) SetDirectFileRoot(dir string) {
// success, or (false, error) on failure.
//
// 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
// config is reloaded. Currently (08/2024) changes safe to apply while running
// are changes to '.AcceptRoutes', '.AdvertiseRoutes' and '.StaticEndpoints'
@ -705,8 +705,7 @@ func (b *LocalBackend) setConfigLocked(conf *conffile.Config, unlock unlockOnce)
return err
}
// needStaticEndpointUpdate accepts a configfile and returns true if the
// configfile contains a change to the static wireguard endpoints.
// needStaticEndpointUpdate reports whether newConf modifies the static wireguard endpoints.
func (b *LocalBackend) needStaticEndpointsUpdate(newConf *conffile.Config) bool {
// If the new configfile does not have static endpoints set and existing
// config does not have any (to unset), no need to update.

View File

@ -645,7 +645,7 @@ func (c *Conn) setEndpoints(endpoints []tailcfg.Endpoint) (changed bool) {
// SetStaticEndpoints sets static endpoints to the provided value and triggers
// 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]) {
c.mu.Lock()
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")
}
// 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] {
c.mu.Lock()
c.mu.Unlock()
return c.staticEndpoints
}