platform: Add tailscale device name and logout
This commit is contained in:
@@ -881,6 +881,18 @@ func (c *CommandClient) SetTailscaleExitNode(endpointTag string, stableID string
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *CommandClient) TailscaleLogout(endpointTag string) error {
|
||||
_, err := callWithResult(c, func(ctx context.Context, client daemon.StartedServiceClient) (*emptypb.Empty, error) {
|
||||
return client.TailscaleLogout(ctx, &daemon.TailscaleLogoutRequest{
|
||||
EndpointTag: endpointTag,
|
||||
})
|
||||
})
|
||||
if err != nil {
|
||||
return E.Cause(err, "tailscale logout")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *CommandClient) StartTailscalePing(endpointTag string, peerIP string, handler TailscalePingHandler) (*TailscalePingSession, error) {
|
||||
client, parentCtx, err := c.getClientForCall()
|
||||
if err != nil {
|
||||
|
||||
@@ -23,6 +23,7 @@ type TailscaleEndpointStatus struct {
|
||||
MagicDNSSuffix string
|
||||
Self *TailscalePeer
|
||||
ExitNode *TailscalePeer
|
||||
KeyAuth bool
|
||||
userGroups []*TailscaleUserGroup
|
||||
}
|
||||
|
||||
@@ -107,6 +108,7 @@ func tailscaleEndpointStatusFromGRPC(status *daemon.TailscaleEndpointStatus) *Ta
|
||||
AuthURL: status.AuthURL,
|
||||
NetworkName: status.NetworkName,
|
||||
MagicDNSSuffix: status.MagicDNSSuffix,
|
||||
KeyAuth: status.GetKeyAuth(),
|
||||
userGroups: userGroups,
|
||||
}
|
||||
if status.Self != nil {
|
||||
|
||||
@@ -187,6 +187,10 @@ func (s *platformInterfaceStub) ReadSystemSSHHostKey() ([]byte, error) {
|
||||
return nil, os.ErrInvalid
|
||||
}
|
||||
|
||||
func (s *platformInterfaceStub) TailscaleHostname() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (s *platformInterfaceStub) LookupUser(username string) (*adapter.PlatformUser, error) {
|
||||
return nil, os.ErrInvalid
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ type PlatformInterface interface {
|
||||
CheckPlatformShell() error
|
||||
OpenShellSession(user *PlatformUser, command string, environ StringIterator, term string, rows int32, cols int32) (ShellSession, error)
|
||||
LookupUser(username string) (*PlatformUser, error)
|
||||
LookupSFTPServer() (*StringBox, error)
|
||||
ReadSystemSSHHostKey() (*StringBox, error)
|
||||
LookupSFTPServer() (string, error)
|
||||
ReadSystemSSHHostKey() (string, error)
|
||||
TailscaleHostname() string
|
||||
}
|
||||
|
||||
type PlatformUser struct {
|
||||
|
||||
@@ -274,11 +274,7 @@ func (w *platformInterfaceWrapper) OpenShellSession(user *adapter.PlatformUser,
|
||||
}
|
||||
|
||||
func (w *platformInterfaceWrapper) LookupSFTPServer() (string, error) {
|
||||
result, err := w.iif.LookupSFTPServer()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return result.Value, nil
|
||||
return w.iif.LookupSFTPServer()
|
||||
}
|
||||
|
||||
func (w *platformInterfaceWrapper) ReadSystemSSHHostKey() ([]byte, error) {
|
||||
@@ -286,7 +282,11 @@ func (w *platformInterfaceWrapper) ReadSystemSSHHostKey() ([]byte, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []byte(result.Value), nil
|
||||
return []byte(result), nil
|
||||
}
|
||||
|
||||
func (w *platformInterfaceWrapper) TailscaleHostname() string {
|
||||
return w.iif.TailscaleHostname()
|
||||
}
|
||||
|
||||
func (w *platformInterfaceWrapper) LookupUser(username string) (*adapter.PlatformUser, error) {
|
||||
|
||||
Reference in New Issue
Block a user