Compare commits

...

2 Commits

Author SHA1 Message Date
Juan Font
4b4200e8a5 Add ko-fi sponsor button 2022-12-22 17:14:06 +01:00
Juan Font
b7d7fc57c4 Add logout method to tsic 2022-12-22 00:09:21 +01:00
4 changed files with 14 additions and 1 deletions

3
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,3 @@
# These are supported funding model platforms
ko_fi: headscale

View File

@@ -141,7 +141,7 @@ func TestAuthWebFlowLogoutAndRelogin(t *testing.T) {
}
for _, client := range allClients {
_, _, err = client.Execute([]string{"tailscale", "logout"})
err := client.Logout()
if err != nil {
t.Errorf("failed to logout client %s: %s", client.Hostname(), err)
}

View File

@@ -15,6 +15,7 @@ type TailscaleClient interface {
Execute(command []string) (string, string, error)
Up(loginServer, authKey string) error
UpWithLoginURL(loginServer string) (*url.URL, error)
Logout() error
IPs() ([]netip.Addr, error)
FQDN() (string, error)
Status() (*ipnstate.Status, error)

View File

@@ -270,6 +270,15 @@ func (t *TailscaleInContainer) UpWithLoginURL(
return loginURL, nil
}
func (t *TailscaleInContainer) Logout() error {
_, _, err := t.Execute([]string{"tailscale", "logout"})
if err != nil {
return err
}
return nil
}
func (t *TailscaleInContainer) IPs() ([]netip.Addr, error) {
if t.ips != nil && len(t.ips) != 0 {
return t.ips, nil