@ -63,6 +63,7 @@ import (
"tailscale.com/types/empty"
"tailscale.com/types/empty"
"tailscale.com/types/key"
"tailscale.com/types/key"
"tailscale.com/types/logger"
"tailscale.com/types/logger"
"tailscale.com/types/logid"
"tailscale.com/types/netmap"
"tailscale.com/types/netmap"
"tailscale.com/types/persist"
"tailscale.com/types/persist"
"tailscale.com/types/preftype"
"tailscale.com/types/preftype"
@ -139,7 +140,7 @@ type LocalBackend struct {
pm * profileManager
pm * profileManager
store ipn . StateStore
store ipn . StateStore
dialer * tsdial . Dialer // non-nil
dialer * tsdial . Dialer // non-nil
backendLogID string
backendLogID logid . PublicID
unregisterLinkMon func ( )
unregisterLinkMon func ( )
unregisterHealthWatch func ( )
unregisterHealthWatch func ( )
portpoll * portlist . Poller // may be nil
portpoll * portlist . Poller // may be nil
@ -265,7 +266,7 @@ type clientGen func(controlclient.Options) (controlclient.Client, error)
// but is not actually running.
// but is not actually running.
//
//
// If dialer is nil, a new one is made.
// If dialer is nil, a new one is made.
func NewLocalBackend ( logf logger . Logf , log id string , store ipn . StateStore , dialer * tsdial . Dialer , e wgengine . Engine , loginFlags controlclient . LoginFlags ) ( * LocalBackend , error ) {
func NewLocalBackend ( logf logger . Logf , log ID logid . PublicID , store ipn . StateStore , dialer * tsdial . Dialer , e wgengine . Engine , loginFlags controlclient . LoginFlags ) ( * LocalBackend , error ) {
if e == nil {
if e == nil {
panic ( "ipn.NewLocalBackend: engine must not be nil" )
panic ( "ipn.NewLocalBackend: engine must not be nil" )
}
}
@ -300,7 +301,7 @@ func NewLocalBackend(logf logger.Logf, logid string, store ipn.StateStore, diale
pm : pm ,
pm : pm ,
store : pm . Store ( ) ,
store : pm . Store ( ) ,
dialer : dialer ,
dialer : dialer ,
backendLogID : log id ,
backendLogID : log ID ,
state : ipn . NoState ,
state : ipn . NoState ,
portpoll : portpoll ,
portpoll : portpoll ,
em : newExpiryManager ( logf ) ,
em : newExpiryManager ( logf ) ,
@ -310,7 +311,7 @@ func NewLocalBackend(logf logger.Logf, logid string, store ipn.StateStore, diale
// for now, only log sockstats on unstable builds
// for now, only log sockstats on unstable builds
if version . IsUnstableBuild ( ) {
if version . IsUnstableBuild ( ) {
b . sockstatLogger , err = sockstatlog . NewLogger ( logpolicy . LogsDir ( logf ) , logf , log id )
b . sockstatLogger , err = sockstatlog . NewLogger ( logpolicy . LogsDir ( logf ) , logf , log ID )
if err != nil {
if err != nil {
log . Printf ( "error setting up sockstat logger: %v" , err )
log . Printf ( "error setting up sockstat logger: %v" , err )
}
}
@ -1294,7 +1295,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
}
}
hostinfo := hostinfo . New ( )
hostinfo := hostinfo . New ( )
hostinfo . BackendLogID = b . backendLogID
hostinfo . BackendLogID = b . backendLogID . String ( )
hostinfo . FrontendLogID = opts . FrontendLogID
hostinfo . FrontendLogID = opts . FrontendLogID
hostinfo . Userspace . Set ( wgengine . IsNetstack ( b . e ) )
hostinfo . Userspace . Set ( wgengine . IsNetstack ( b . e ) )
hostinfo . UserspaceRouter . Set ( wgengine . IsNetstackRouter ( b . e ) )
hostinfo . UserspaceRouter . Set ( wgengine . IsNetstackRouter ( b . e ) )
@ -1448,7 +1449,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
b . e . SetNetInfoCallback ( b . setNetInfo )
b . e . SetNetInfoCallback ( b . setNetInfo )
blid := b . backendLogID
blid := b . backendLogID . String ( )
b . logf ( "Backend: logs: be:%v fe:%v" , blid , opts . FrontendLogID )
b . logf ( "Backend: logs: be:%v fe:%v" , blid , opts . FrontendLogID )
b . send ( ipn . Notify { BackendLogID : & blid } )
b . send ( ipn . Notify { BackendLogID : & blid } )
b . send ( ipn . Notify { Prefs : & prefs } )
b . send ( ipn . Notify { Prefs : & prefs } )