File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,10 @@ func (header *Header) formatVersion1() ([]byte, error) {
216216
217217func parseV1PortNumber (portStr string ) (int , error ) {
218218 port , err := strconv .Atoi (portStr )
219- if err != nil || port < 0 || port > 65535 {
219+ if err != nil {
220+ return 0 , fmt .Errorf ("%w: %w" , ErrInvalidPortNumber , err )
221+ }
222+ if port < 0 || port > 65535 {
220223 return 0 , ErrInvalidPortNumber
221224 }
222225 return port , nil
@@ -225,7 +228,7 @@ func parseV1PortNumber(portStr string) (int, error) {
225228func parseV1IPAddress (protocol AddressFamilyAndProtocol , addrStr string ) (net.IP , error ) {
226229 addr , err := netip .ParseAddr (addrStr )
227230 if err != nil {
228- return nil , ErrInvalidAddress
231+ return nil , fmt . Errorf ( "%w: %w" , ErrInvalidAddress , err )
229232 }
230233
231234 switch protocol {
You can’t perform that action at this time.
0 commit comments