chore: cleanup

This commit is contained in:
ArcticLampyrid 2024-11-15 02:57:01 +08:00
parent b0f074d18d
commit 28a40c0019
No known key found for this signature in database
GPG key ID: DC72A2519E77D6CF
3 changed files with 10 additions and 6 deletions

View file

@ -64,6 +64,7 @@ func (h *Headscale) VerifyHandler(
) {
if req.Method != http.MethodPost {
http.Error(writer, "Wrong method", http.StatusMethodNotAllowed)
return
}
log.Debug().

View file

@ -72,7 +72,7 @@ func WithOrCreateNetwork(network *dockertest.Network) Option {
network, err := dockertestutil.GetFirstOrCreateNetwork(
tsic.pool,
fmt.Sprintf("%s-network", tsic.hostname),
tsic.hostname+"-network",
)
if err != nil {
log.Fatalf("failed to create network: %s", err)
@ -226,6 +226,7 @@ func New(
return nil, fmt.Errorf("failed to write TLS key to container: %w", err)
}
}
return dsic, nil
}
@ -239,6 +240,7 @@ func (t *DERPServerInContainer) Shutdown() error {
fmt.Errorf("failed to save log: %w", err),
)
}
return t.pool.Purge(t.container)
}

View file

@ -675,7 +675,7 @@ func (t *TailscaleInContainer) watchIPN(ctx context.Context) (*ipn.Notify, error
func (t *TailscaleInContainer) DebugDERPRegion(region string) (*ipnstate.DebugDERPRegionReport, error) {
if !util.TailscaleVersionNewerOrEqual("1.34", t.version) {
panic(fmt.Sprintf("tsic.DebugDERPRegion() called with unsupported version: %s", t.version))
panic("tsic.DebugDERPRegion() called with unsupported version: " + t.version)
}
command := []string{
@ -687,17 +687,18 @@ func (t *TailscaleInContainer) DebugDERPRegion(region string) (*ipnstate.DebugDE
result, stderr, err := t.Execute(command)
if err != nil {
fmt.Printf("stderr: %s\n", stderr)
fmt.Printf("stderr: %s\n", stderr) // nolint
return nil, fmt.Errorf("failed to execute tailscale debug derp command: %w", err)
}
var st ipnstate.DebugDERPRegionReport
err = json.Unmarshal([]byte(result), &st)
var report ipnstate.DebugDERPRegionReport
err = json.Unmarshal([]byte(result), &report)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal tailscale derp region report: %w", err)
}
return &st, err
return &report, err
}
// Netcheck returns the current Netcheck Report (netcheck.Report) of the Tailscale instance.