File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ package main
17
17
import (
18
18
"fmt"
19
19
"net"
20
+ "net/netip"
20
21
"strconv"
21
22
"sync"
22
23
"time"
@@ -72,7 +73,7 @@ type activeClient struct {
72
73
}
73
74
74
75
type IPKey struct {
75
- ip string
76
+ ip netip. Addr
76
77
accessKey string
77
78
}
78
79
@@ -109,7 +110,7 @@ func (t *tunnelTimeTracker) reportDuration(c *activeClient, now time.Time) {
109
110
// Registers a new active connection for a client [net.Addr] and access key.
110
111
func (t * tunnelTimeTracker ) startConnection (clientInfo ipinfo.IPInfo , clientAddr net.Addr , accessKey string ) {
111
112
hostname , _ , _ := net .SplitHostPort (clientAddr .String ())
112
- ipKey := IPKey {ip : hostname , accessKey : accessKey }
113
+ ipKey := IPKey {ip : netip . MustParseAddr ( hostname ) , accessKey : accessKey }
113
114
114
115
t .mu .Lock ()
115
116
defer t .mu .Unlock ()
@@ -128,7 +129,7 @@ func (t *tunnelTimeTracker) startConnection(clientInfo ipinfo.IPInfo, clientAddr
128
129
// Removes an active connection for a client [net.Addr] and access key.
129
130
func (t * tunnelTimeTracker ) stopConnection (clientAddr net.Addr , accessKey string ) {
130
131
hostname , _ , _ := net .SplitHostPort (clientAddr .String ())
131
- ipKey := IPKey {ip : hostname , accessKey : accessKey }
132
+ ipKey := IPKey {ip : netip . MustParseAddr ( hostname ) , accessKey : accessKey }
132
133
133
134
t .mu .Lock ()
134
135
defer t .mu .Unlock ()
You can’t perform that action at this time.
0 commit comments