@@ -442,7 +442,7 @@ func (cl *Client) incomingConnection(nc net.Conn) {
442
442
if tc , ok := nc .(* net.TCPConn ); ok {
443
443
tc .SetLinger (0 )
444
444
}
445
- c := cl .newConnection (nc , false , ipPortFromNetAddr (nc .RemoteAddr ()), nc .RemoteAddr ().Network ())
445
+ c := cl .newConnection (nc , false , missinggo . IpPortFromNetAddr (nc .RemoteAddr ()), nc .RemoteAddr ().Network ())
446
446
c .Discovery = peerSourceIncoming
447
447
cl .runReceivedConn (c )
448
448
}
@@ -585,7 +585,7 @@ func (cl *Client) noLongerHalfOpen(t *Torrent, addr string) {
585
585
586
586
// Performs initiator handshakes and returns a connection. Returns nil
587
587
// *connection if no connection for valid reasons.
588
- func (cl * Client ) handshakesConnection (ctx context.Context , nc net.Conn , t * Torrent , encryptHeader bool , remoteAddr ipPort , network string ) (c * connection , err error ) {
588
+ func (cl * Client ) handshakesConnection (ctx context.Context , nc net.Conn , t * Torrent , encryptHeader bool , remoteAddr IpPort , network string ) (c * connection , err error ) {
589
589
c = cl .newConnection (nc , true , remoteAddr , network )
590
590
c .headerEncrypted = encryptHeader
591
591
ctx , cancel := context .WithTimeout (ctx , cl .config .HandshakesTimeout )
@@ -607,7 +607,7 @@ func (cl *Client) handshakesConnection(ctx context.Context, nc net.Conn, t *Torr
607
607
608
608
// Returns nil connection and nil error if no connection could be established
609
609
// for valid reasons.
610
- func (cl * Client ) establishOutgoingConnEx (t * Torrent , addr ipPort , ctx context.Context , obfuscatedHeader bool ) (c * connection , err error ) {
610
+ func (cl * Client ) establishOutgoingConnEx (t * Torrent , addr IpPort , ctx context.Context , obfuscatedHeader bool ) (c * connection , err error ) {
611
611
dr := cl .dialFirst (ctx , addr .String ())
612
612
nc := dr .Conn
613
613
if nc == nil {
@@ -623,7 +623,7 @@ func (cl *Client) establishOutgoingConnEx(t *Torrent, addr ipPort, ctx context.C
623
623
624
624
// Returns nil connection and nil error if no connection could be established
625
625
// for valid reasons.
626
- func (cl * Client ) establishOutgoingConn (t * Torrent , addr ipPort ) (c * connection , err error ) {
626
+ func (cl * Client ) establishOutgoingConn (t * Torrent , addr IpPort ) (c * connection , err error ) {
627
627
torrent .Add ("establish outgoing connection" , 1 )
628
628
ctx , cancel := context .WithTimeout (context .Background (), func () time.Duration {
629
629
cl .rLock ()
@@ -658,7 +658,7 @@ func (cl *Client) establishOutgoingConn(t *Torrent, addr ipPort) (c *connection,
658
658
659
659
// Called to dial out and run a connection. The addr we're given is already
660
660
// considered half-open.
661
- func (cl * Client ) outgoingConnection (t * Torrent , addr ipPort , ps peerSource ) {
661
+ func (cl * Client ) outgoingConnection (t * Torrent , addr IpPort , ps peerSource ) {
662
662
cl .dialRateLimiter .Wait (context .Background ())
663
663
c , err := cl .establishOutgoingConn (t , addr )
664
664
cl .lock ()
@@ -1182,7 +1182,7 @@ func (cl *Client) banPeerIP(ip net.IP) {
1182
1182
cl .badPeerIPs [ip .String ()] = struct {}{}
1183
1183
}
1184
1184
1185
- func (cl * Client ) newConnection (nc net.Conn , outgoing bool , remoteAddr ipPort , network string ) (c * connection ) {
1185
+ func (cl * Client ) newConnection (nc net.Conn , outgoing bool , remoteAddr IpPort , network string ) (c * connection ) {
1186
1186
c = & connection {
1187
1187
conn : nc ,
1188
1188
outgoing : outgoing ,
@@ -1263,8 +1263,8 @@ func (cl *Client) findListenerIp(f func(net.IP) bool) net.IP {
1263
1263
}
1264
1264
1265
1265
// Our IP as a peer should see it.
1266
- func (cl * Client ) publicAddr (peer net.IP ) ipPort {
1267
- return ipPort {cl .publicIp (peer ), uint16 (cl .incomingPeerPort ())}
1266
+ func (cl * Client ) publicAddr (peer net.IP ) IpPort {
1267
+ return IpPort {cl .publicIp (peer ), uint16 (cl .incomingPeerPort ())}
1268
1268
}
1269
1269
1270
1270
func (cl * Client ) ListenAddrs () (ret []net.Addr ) {
@@ -1277,7 +1277,7 @@ func (cl *Client) ListenAddrs() (ret []net.Addr) {
1277
1277
return
1278
1278
}
1279
1279
1280
- func (cl * Client ) onBadAccept (addr ipPort ) {
1280
+ func (cl * Client ) onBadAccept (addr IpPort ) {
1281
1281
ip := maskIpForAcceptLimiting (addr .IP )
1282
1282
if cl .acceptLimiter == nil {
1283
1283
cl .acceptLimiter = make (map [ipStr ]int )
0 commit comments