@ -67,7 +67,7 @@ type Direct struct {
linkMon * monitor . Mon // or nil
linkMon * monitor . Mon // or nil
discoPubKey key . DiscoPublic
discoPubKey key . DiscoPublic
getMachinePrivKey func ( ) ( key . MachinePrivate , error )
getMachinePrivKey func ( ) ( key . MachinePrivate , error )
getNLPublicKey func ( ) ( key . NLPublic , error )
getNLPublicKey func ( ) ( key . NLPublic , error ) // or nil
debugFlags [ ] string
debugFlags [ ] string
keepSharerAndUserSplit bool
keepSharerAndUserSplit bool
skipIPForwardingCheck bool
skipIPForwardingCheck bool
@ -108,6 +108,9 @@ type Options struct {
LinkMonitor * monitor . Mon // optional link monitor
LinkMonitor * monitor . Mon // optional link monitor
PopBrowserURL func ( url string ) // optional func to open browser
PopBrowserURL func ( url string ) // optional func to open browser
Dialer * tsdial . Dialer // non-nil
Dialer * tsdial . Dialer // non-nil
// GetNLPublicKey specifies an optional function to use
// Network Lock. If nil, it's not used.
GetNLPublicKey func ( ) ( key . NLPublic , error )
GetNLPublicKey func ( ) ( key . NLPublic , error )
// Status is called when there's a change in status.
// Status is called when there's a change in status.
@ -427,10 +430,13 @@ func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, new
oldNodeKey = persist . OldPrivateNodeKey . Public ( )
oldNodeKey = persist . OldPrivateNodeKey . Public ( )
}
}
nlPub , err := c . getNLPublicKey ( )
var nlPub key . NLPublic
if c . getNLPublicKey != nil {
nlPub , err = c . getNLPublicKey ( )
if err != nil {
if err != nil {
return false , "" , fmt . Errorf ( "get nl key: %v" , err )
return false , "" , fmt . Errorf ( "get nl key: %v" , err )
}
}
}
if tryingNewKey . IsZero ( ) {
if tryingNewKey . IsZero ( ) {
if opt . Logout {
if opt . Logout {