Fix linting errors
This commit is contained in:
@@ -136,11 +136,11 @@ func AddNetworkDebugData(di *debug.Info, profile, where string) {
|
||||
|
||||
// Collect matching connections.
|
||||
var ( //nolint:prealloc // We don't know the size.
|
||||
debugConns []*Connection
|
||||
accepted int
|
||||
total int
|
||||
debugConns []*Connection
|
||||
accepted int
|
||||
total int
|
||||
)
|
||||
|
||||
|
||||
for maybeConn := range it.Next {
|
||||
// Switch to correct type.
|
||||
conn, ok := maybeConn.(*Connection)
|
||||
|
||||
@@ -751,12 +751,14 @@ func (conn *Connection) SaveWhenFinished() {
|
||||
func (conn *Connection) Save() {
|
||||
conn.UpdateMeta()
|
||||
|
||||
// nolint:exhaustive
|
||||
switch conn.Verdict {
|
||||
case VerdictAccept, VerdictRerouteToNameserver:
|
||||
conn.ConnectionEstablished = true
|
||||
case VerdictRerouteToTunnel:
|
||||
// this is already handled when the connection tunnel has been
|
||||
// established.
|
||||
default:
|
||||
}
|
||||
|
||||
// Do not save/update until data is complete.
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
)
|
||||
@@ -207,9 +208,9 @@ func (pkt *Base) FmtRemoteIP() string {
|
||||
func (pkt *Base) FmtRemotePort() string {
|
||||
if pkt.info.SrcPort != 0 {
|
||||
if pkt.info.Inbound {
|
||||
return fmt.Sprintf("%d", pkt.info.SrcPort)
|
||||
return strconv.FormatUint(uint64(pkt.info.SrcPort), 10)
|
||||
}
|
||||
return fmt.Sprintf("%d", pkt.info.DstPort)
|
||||
return strconv.FormatUint(uint64(pkt.info.DstPort), 10)
|
||||
}
|
||||
return "-"
|
||||
}
|
||||
@@ -235,10 +236,10 @@ type Packet interface {
|
||||
ExpectInfo() bool
|
||||
|
||||
// Info.
|
||||
SetCtx(context.Context)
|
||||
SetCtx(ctx context.Context)
|
||||
Ctx() context.Context
|
||||
Info() *Info
|
||||
SetPacketInfo(Info)
|
||||
SetPacketInfo(info Info)
|
||||
IsInbound() bool
|
||||
IsOutbound() bool
|
||||
SetInbound()
|
||||
@@ -253,8 +254,8 @@ type Packet interface {
|
||||
Payload() []byte
|
||||
|
||||
// Matching.
|
||||
MatchesAddress(bool, IPProtocol, *net.IPNet, uint16) bool
|
||||
MatchesIP(bool, *net.IPNet) bool
|
||||
MatchesAddress(remote bool, protocol IPProtocol, network *net.IPNet, port uint16) bool
|
||||
MatchesIP(endpoint bool, network *net.IPNet) bool
|
||||
|
||||
// Formatting.
|
||||
String() string
|
||||
|
||||
@@ -44,7 +44,7 @@ type Address struct {
|
||||
// Info is a generic interface to both ConnectionInfo and BindInfo.
|
||||
type Info interface {
|
||||
GetPID() int
|
||||
SetPID(int)
|
||||
SetPID(pid int)
|
||||
GetUID() int
|
||||
GetUIDandInode() (int, int)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user