mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 02:43:05 +00:00
chore: cleanup
This commit is contained in:
parent
b0f074d18d
commit
28a40c0019
3 changed files with 10 additions and 6 deletions
|
@ -64,6 +64,7 @@ func (h *Headscale) VerifyHandler(
|
||||||
) {
|
) {
|
||||||
if req.Method != http.MethodPost {
|
if req.Method != http.MethodPost {
|
||||||
http.Error(writer, "Wrong method", http.StatusMethodNotAllowed)
|
http.Error(writer, "Wrong method", http.StatusMethodNotAllowed)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Debug().
|
log.Debug().
|
||||||
|
|
|
@ -72,7 +72,7 @@ func WithOrCreateNetwork(network *dockertest.Network) Option {
|
||||||
|
|
||||||
network, err := dockertestutil.GetFirstOrCreateNetwork(
|
network, err := dockertestutil.GetFirstOrCreateNetwork(
|
||||||
tsic.pool,
|
tsic.pool,
|
||||||
fmt.Sprintf("%s-network", tsic.hostname),
|
tsic.hostname+"-network",
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to create network: %s", err)
|
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 nil, fmt.Errorf("failed to write TLS key to container: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dsic, nil
|
return dsic, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +240,7 @@ func (t *DERPServerInContainer) Shutdown() error {
|
||||||
fmt.Errorf("failed to save log: %w", err),
|
fmt.Errorf("failed to save log: %w", err),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return t.pool.Purge(t.container)
|
return t.pool.Purge(t.container)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -675,7 +675,7 @@ func (t *TailscaleInContainer) watchIPN(ctx context.Context) (*ipn.Notify, error
|
||||||
|
|
||||||
func (t *TailscaleInContainer) DebugDERPRegion(region string) (*ipnstate.DebugDERPRegionReport, error) {
|
func (t *TailscaleInContainer) DebugDERPRegion(region string) (*ipnstate.DebugDERPRegionReport, error) {
|
||||||
if !util.TailscaleVersionNewerOrEqual("1.34", t.version) {
|
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{
|
command := []string{
|
||||||
|
@ -687,17 +687,18 @@ func (t *TailscaleInContainer) DebugDERPRegion(region string) (*ipnstate.DebugDE
|
||||||
|
|
||||||
result, stderr, err := t.Execute(command)
|
result, stderr, err := t.Execute(command)
|
||||||
if err != nil {
|
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)
|
return nil, fmt.Errorf("failed to execute tailscale debug derp command: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var st ipnstate.DebugDERPRegionReport
|
var report ipnstate.DebugDERPRegionReport
|
||||||
err = json.Unmarshal([]byte(result), &st)
|
err = json.Unmarshal([]byte(result), &report)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to unmarshal tailscale derp region report: %w", err)
|
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.
|
// Netcheck returns the current Netcheck Report (netcheck.Report) of the Tailscale instance.
|
||||||
|
|
Loading…
Reference in a new issue