fix typos in comments

Co-authored-by: Halimao <1065621723@qq.com>
This commit is contained in:
Felix Lange 2024-05-28 21:56:29 +02:00 committed by GitHub
parent 3dfe877b1d
commit 0a0d38f3ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 6 deletions

View file

@ -58,14 +58,14 @@ func newMeteredConn(conn UDPConn) UDPConn {
return &meteredUdpConn{UDPConn: conn}
}
// ReadFromUDP delegates a network read to the underlying connection, bumping the udp ingress traffic meter along the way.
// ReadFromUDPAddrPort delegates a network read to the underlying connection, bumping the udp ingress traffic meter along the way.
func (c *meteredUdpConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
n, addr, err = c.UDPConn.ReadFromUDPAddrPort(b)
ingressTrafficMeter.Mark(int64(n))
return n, addr, err
}
// Write delegates a network write to the underlying connection, bumping the udp egress traffic meter along the way.
// WriteToUDP delegates a network write to the underlying connection, bumping the udp egress traffic meter along the way.
func (c *meteredUdpConn) WriteToUDP(b []byte, addr netip.AddrPort) (n int, err error) {
n, err = c.UDPConn.WriteToUDPAddrPort(b, addr)
egressTrafficMeter.Mark(int64(n))

View file

@ -592,7 +592,7 @@ func newpipe() *dgramPipe {
}
}
// WriteToUDP queues a datagram.
// WriteToUDPAddrPort queues a datagram.
func (c *dgramPipe) WriteToUDPAddrPort(b []byte, to netip.AddrPort) (n int, err error) {
msg := make([]byte, len(b))
copy(msg, b)
@ -606,7 +606,7 @@ func (c *dgramPipe) WriteToUDPAddrPort(b []byte, to netip.AddrPort) (n int, err
return len(b), nil
}
// ReadFromUDP just hangs until the pipe is closed.
// ReadFromUDPAddrPort just hangs until the pipe is closed.
func (c *dgramPipe) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
<-c.closing
return 0, netip.AddrPort{}, io.EOF

View file

@ -776,7 +776,7 @@ func (test *udpV5Test) packetIn(packet v5wire.Packet) {
test.packetInFrom(test.remotekey, test.remoteaddr, packet)
}
// handles a packet as if it had been sent to the transport by the key/endpoint.
// packetInFrom handles a packet as if it had been sent to the transport by the key/endpoint.
func (test *udpV5Test) packetInFrom(key *ecdsa.PrivateKey, addr netip.AddrPort, packet v5wire.Packet) {
test.t.Helper()

View file

@ -436,7 +436,7 @@ type sharedUDPConn struct {
unhandled chan discover.ReadPacket
}
// ReadFromUDP implements discover.UDPConn
// ReadFromUDPAddrPort implements discover.UDPConn
func (s *sharedUDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
packet, ok := <-s.unhandled
if !ok {