Skip to content

Commit fa10199

Browse files
committed
chore: move tailscale api response struct to tailscale service
1 parent e4101c4 commit fa10199

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

internal/model/config.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ type Config struct {
8888
LabelProvider string `description:"Label provider to use for ACLs (auto, docker, kubernetes or none to disable). auto detects the environment." yaml:"labelProvider"`
8989
Log LogConfig `description:"Logging configuration." yaml:"log"`
9090
Tailscale TailscaleConfig `description:"Tailscale configuration." yaml:"tailscale"`
91-
LabelProvider string `description:"Label provider to use (docker, kubernetes, auto)." yaml:"labelProvider"`
9291
}
9392

9493
type DatabaseConfig struct {
@@ -244,14 +243,6 @@ type OIDCClientConfig struct {
244243
Name string `description:"Client name in UI." yaml:"name"`
245244
}
246245

247-
type TailscaleWhoisResponse struct {
248-
UserID string
249-
LoginName string
250-
DisplayName string
251-
NodeName string
252-
Tags []string
253-
}
254-
255246
type ACLsConfig struct {
256247
Policy string `description:"ACL policy for allow-by-default or deny-by-default, available options are allow and deny, default is allow." yaml:"policy"`
257248
}

internal/service/tailscale_service.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ import (
1515
"tailscale.com/tsnet"
1616
)
1717

18+
type TailscaleWhoisResponse struct {
19+
UserID string
20+
LoginName string
21+
DisplayName string
22+
NodeName string
23+
Tags []string
24+
}
25+
1826
type TailscaleService struct {
1927
log *logger.Logger
2028
wg *sync.WaitGroup
@@ -89,7 +97,7 @@ func (ts *TailscaleService) watchAndClose() {
8997
}
9098
}
9199

92-
func (ts *TailscaleService) Whois(ctx context.Context, addr string) (*model.TailscaleWhoisResponse, error) {
100+
func (ts *TailscaleService) Whois(ctx context.Context, addr string) (*TailscaleWhoisResponse, error) {
93101
who, err := ts.lc.WhoIs(ctx, addr)
94102

95103
if err != nil {
@@ -99,7 +107,7 @@ func (ts *TailscaleService) Whois(ctx context.Context, addr string) (*model.Tail
99107
return nil, fmt.Errorf("failed to get client whois: %w", err)
100108
}
101109

102-
res := model.TailscaleWhoisResponse{
110+
res := TailscaleWhoisResponse{
103111
UserID: who.UserProfile.ID.String(),
104112
LoginName: who.UserProfile.LoginName,
105113
DisplayName: who.UserProfile.DisplayName,

0 commit comments

Comments
 (0)