Skip to content

Commit 6a7cfd6

Browse files
committed
Refactor: return ID copy in TCP/UDPConn
1 parent 8fae79e commit 6a7cfd6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

core/adapter/adapter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type TCPConn interface {
1111
net.Conn
1212

1313
// ID returns the transport endpoint id of TCPConn.
14-
ID() *stack.TransportEndpointID
14+
ID() stack.TransportEndpointID
1515
}
1616

1717
// UDPConn implements net.Conn and net.PacketConn.
@@ -20,5 +20,5 @@ type UDPConn interface {
2020
net.PacketConn
2121

2222
// ID returns the transport endpoint id of UDPConn.
23-
ID() *stack.TransportEndpointID
23+
ID() stack.TransportEndpointID
2424
}

core/tcp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ type tcpConn struct {
117117
id stack.TransportEndpointID
118118
}
119119

120-
func (c *tcpConn) ID() *stack.TransportEndpointID {
121-
return &c.id
120+
func (c *tcpConn) ID() stack.TransportEndpointID {
121+
return c.id
122122
}

core/udp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ type udpConn struct {
4242
id stack.TransportEndpointID
4343
}
4444

45-
func (c *udpConn) ID() *stack.TransportEndpointID {
46-
return &c.id
45+
func (c *udpConn) ID() stack.TransportEndpointID {
46+
return c.id
4747
}

0 commit comments

Comments
 (0)