mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-20 19:09:07 +01:00
Some linting fixes
This commit is contained in:
parent
ade1b73779
commit
3bea20850a
5
noise.go
5
noise.go
@ -113,6 +113,7 @@ func (h *Headscale) getNoiseConnection(
|
||||
if err != nil {
|
||||
log.Error().Caller().Err(err).Msgf("Hijack failed")
|
||||
http.Error(writer, "HTTP does not support general TCP support", http.StatusInternalServerError)
|
||||
|
||||
return nil, errCannotHijack
|
||||
}
|
||||
if err := conn.Flush(); err != nil {
|
||||
@ -123,12 +124,12 @@ func (h *Headscale) getNoiseConnection(
|
||||
|
||||
netConn = netutil.NewDrainBufConn(netConn, conn.Reader)
|
||||
|
||||
nc, err := controlbase.Server(req.Context(), netConn, *h.noisePrivateKey, init)
|
||||
noiseConn, err := controlbase.Server(req.Context(), netConn, *h.noisePrivateKey, init)
|
||||
if err != nil {
|
||||
netConn.Close()
|
||||
|
||||
return nil, errNoiseHandshakeFailed
|
||||
}
|
||||
|
||||
return nc, nil
|
||||
return noiseConn, nil
|
||||
}
|
||||
|
11
noise_api.go
11
noise_api.go
@ -22,6 +22,7 @@ func (h *Headscale) NoiseRegistrationHandler(
|
||||
log.Trace().Caller().Msgf("Noise registration handler for client %s", req.RemoteAddr)
|
||||
if req.Method != http.MethodPost {
|
||||
http.Error(writer, "Wrong method", http.StatusMethodNotAllowed)
|
||||
|
||||
return
|
||||
}
|
||||
body, _ := io.ReadAll(req.Body)
|
||||
@ -296,8 +297,8 @@ func (h *Headscale) handleNoiseAuthKey(
|
||||
}
|
||||
|
||||
func (h *Headscale) handleNoiseNodeValidRegistration(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
writer http.ResponseWriter,
|
||||
req *http.Request,
|
||||
machine Machine,
|
||||
) {
|
||||
resp := tailcfg.RegisterResponse{}
|
||||
@ -314,9 +315,9 @@ func (h *Headscale) handleNoiseNodeValidRegistration(
|
||||
|
||||
machineRegistrations.WithLabelValues("update", "web", "success", machine.Namespace.Name).
|
||||
Inc()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(resp)
|
||||
writer.Header().Set("Content-Type", "application/json")
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(writer).Encode(resp)
|
||||
}
|
||||
|
||||
func (h *Headscale) handleNoiseMachineRegistrationNew(
|
||||
|
Loading…
Reference in New Issue
Block a user