Skip to content

Commit

Permalink
parsePacket() -> validatePacket()
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Schwartz committed Nov 2, 2020
1 parent e39d582 commit 262ac75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions service/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (s *udpService) Serve(clientConn net.PacketConn) error {
}

var onetErr *onet.ConnectionError
if payload, tgtUDPAddr, onetErr = s.parsePacket(textData); onetErr != nil {
if payload, tgtUDPAddr, onetErr = s.validatePacket(textData); onetErr != nil {
return onetErr
}

Expand All @@ -209,7 +209,7 @@ func (s *udpService) Serve(clientConn net.PacketConn) error {
}

var onetErr *onet.ConnectionError
if payload, tgtUDPAddr, onetErr = s.parsePacket(textData); onetErr != nil {
if payload, tgtUDPAddr, onetErr = s.validatePacket(textData); onetErr != nil {
return onetErr
}
}
Expand All @@ -229,7 +229,7 @@ func (s *udpService) Serve(clientConn net.PacketConn) error {
// Given the decrypted contents of a UDP packet, return
// the payload and the destination address, or an error if
// this packet cannot or should not be forwarded.
func (s *udpService) parsePacket(textData []byte) ([]byte, *net.UDPAddr, *onet.ConnectionError) {
func (s *udpService) validatePacket(textData []byte) ([]byte, *net.UDPAddr, *onet.ConnectionError) {
tgtAddr := socks.SplitAddr(textData)
if tgtAddr == nil {
return nil, nil, onet.NewConnectionError("ERR_READ_ADDRESS", "Failed to get target address", nil)
Expand Down

0 comments on commit 262ac75

Please sign in to comment.