Skip to content

Commit

Permalink
Refactor port{min,max} to port{Min,Max}
Browse files Browse the repository at this point in the history
As most variable names are using camelCase.
  • Loading branch information
stv0g committed Nov 13, 2022
1 parent 90a16ec commit 97c77bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ type Agent struct {
prflxAcceptanceMinWait time.Duration
relayAcceptanceMinWait time.Duration

portmin uint16
portmax uint16
portMin uint16
portMax uint16

candidateTypes []CandidateType

Expand Down Expand Up @@ -297,8 +297,8 @@ func NewAgent(config *AgentConfig) (*Agent, error) { //nolint:gocognit
taskLoopDone: make(chan struct{}),
startedCh: startedCtx.Done(),
startedFn: startedFn,
portmin: config.PortMin,
portmax: config.PortMax,
portMin: config.PortMin,
portMax: config.PortMax,
loggerFactory: loggerFactory,
log: log,
net: config.Net,
Expand Down
6 changes: 3 additions & 3 deletions gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (a *Agent) gatherCandidatesLocal(ctx context.Context, networkTypes []Networ
// is there a way to verify that the listen address is even
// accessible from the current interface.
case udp:
conn, err := listenUDPInPortRange(a.net, a.log, int(a.portmax), int(a.portmin), network, &net.UDPAddr{IP: ip, Port: 0})
conn, err := listenUDPInPortRange(a.net, a.log, int(a.portMax), int(a.portMin), network, &net.UDPAddr{IP: ip, Port: 0})
if err != nil {
a.log.Warnf("could not listen %s %s", network, ip)
continue
Expand Down Expand Up @@ -334,7 +334,7 @@ func (a *Agent) gatherCandidatesSrflxMapped(ctx context.Context, networkTypes []
go func() {
defer wg.Done()

conn, err := listenUDPInPortRange(a.net, a.log, int(a.portmax), int(a.portmin), network, &net.UDPAddr{IP: nil, Port: 0})
conn, err := listenUDPInPortRange(a.net, a.log, int(a.portMax), int(a.portMin), network, &net.UDPAddr{IP: nil, Port: 0})
if err != nil {
a.log.Warnf("Failed to listen %s: %v", network, err)
return
Expand Down Expand Up @@ -469,7 +469,7 @@ func (a *Agent) gatherCandidatesSrflx(ctx context.Context, urls []*URL, networkT
return
}

conn, err := listenUDPInPortRange(a.net, a.log, int(a.portmax), int(a.portmin), network, &net.UDPAddr{IP: nil, Port: 0})
conn, err := listenUDPInPortRange(a.net, a.log, int(a.portMax), int(a.portMin), network, &net.UDPAddr{IP: nil, Port: 0})
if err != nil {
closeConnAndLog(conn, a.log, fmt.Sprintf("Failed to listen for %s: %v", serverAddr.String(), err))
return
Expand Down

0 comments on commit 97c77bb

Please sign in to comment.