@ -129,7 +129,7 @@ func (e *serveEnv) newFlags(name string, setup func(fs *flag.FlagSet)) *flag.Fla
//
//
// The purpose of this interface is to allow tests to provide a mock.
// The purpose of this interface is to allow tests to provide a mock.
type localServeClient interface {
type localServeClient interface {
Status ( context . Context ) ( * ipnstate . Status , error )
Status WithoutPeers ( context . Context ) ( * ipnstate . Status , error )
GetServeConfig ( context . Context ) ( * ipn . ServeConfig , error )
GetServeConfig ( context . Context ) ( * ipn . ServeConfig , error )
SetServeConfig ( context . Context , * ipn . ServeConfig ) error
SetServeConfig ( context . Context , * ipn . ServeConfig ) error
QueryFeature ( ctx context . Context , feature string ) ( * tailcfg . QueryFeatureResponse , error )
QueryFeature ( ctx context . Context , feature string ) ( * tailcfg . QueryFeatureResponse , error )
@ -158,19 +158,21 @@ type serveEnv struct {
// The trailing dot is removed.
// The trailing dot is removed.
// Returns an error if local client status fails.
// Returns an error if local client status fails.
func ( e * serveEnv ) getSelfDNSName ( ctx context . Context ) ( string , error ) {
func ( e * serveEnv ) getSelfDNSName ( ctx context . Context ) ( string , error ) {
st , err := e . getLocalClientStatus ( ctx )
st , err := e . getLocalClientStatus WithoutPeers ( ctx )
if err != nil {
if err != nil {
return "" , fmt . Errorf ( "getting client status: %w" , err )
return "" , fmt . Errorf ( "getting client status: %w" , err )
}
}
return strings . TrimSuffix ( st . Self . DNSName , "." ) , nil
return strings . TrimSuffix ( st . Self . DNSName , "." ) , nil
}
}
// getLocalClientStatus returns the Status of the local client.
// getLocalClientStatusWithoutPeers returns the Status of the local client
// without any peers in the response.
//
// Returns error if unable to reach tailscaled or if self node is nil.
// Returns error if unable to reach tailscaled or if self node is nil.
//
//
// Exits if status is not running or starting.
// Exits if status is not running or starting.
func ( e * serveEnv ) getLocalClientStatus ( ctx context . Context ) ( * ipnstate . Status , error ) {
func ( e * serveEnv ) getLocalClientStatus WithoutPeers ( ctx context . Context ) ( * ipnstate . Status , error ) {
st , err := e . lc . Status ( ctx )
st , err := e . lc . Status WithoutPeers ( ctx )
if err != nil {
if err != nil {
return nil , fixTailscaledConnectError ( err )
return nil , fixTailscaledConnectError ( err )
}
}
@ -641,7 +643,7 @@ func (e *serveEnv) runServeStatus(ctx context.Context, args []string) error {
printf ( "No serve config\n" )
printf ( "No serve config\n" )
return nil
return nil
}
}
st , err := e . getLocalClientStatus ( ctx )
st , err := e . getLocalClientStatus WithoutPeers ( ctx )
if err != nil {
if err != nil {
return err
return err
}
}