Skip to content

Commit

Permalink
chore: fix lint errors
Browse files Browse the repository at this point in the history
* check error
* remove unused function
  • Loading branch information
smlx committed Nov 24, 2023
1 parent f20f5ec commit fa50f55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 5 additions & 1 deletion mitm/mitm.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ func Serve(ctx context.Context, log *slog.Logger) error {
break
}
// accept incoming connections
listener.SetDeadline(time.Now().Add(listenTimeout))
if err = listener.SetDeadline(time.Now().Add(listenTimeout)); err != nil {
log.Error("couldn't set deadline on listener", slog.Any("error", err))
cancel()
break
}
conn, err := listener.Accept()
if err != nil {
// check if timeout reached
Expand Down
9 changes: 0 additions & 9 deletions mitm/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,6 @@ func parseTimeSync(cleartext []byte) (*OutboundTimeSync, error) {
return &body, nil
}

// deviceModel takes a device ID and returns the device model if the device is
// known. If the device is not known it returns an error.
func deviceModel(deviceID [8]byte) (string, error) {
if model, ok := deviceIDToModel[deviceID]; ok {
return model, nil
}
return "", fmt.Errorf("unknown device ID: %v", deviceID)
}

// handleTimeSyncPacket handles time sync packet envelope and ciphertext.
func handleTimeSyncPacket(
buf *bytes.Buffer,
Expand Down

0 comments on commit fa50f55

Please sign in to comment.