// checkHeader validates the header bytes of a NAT-PMP response.
checkHeader validates the header bytes of a NAT-PMP response.
// checkHeader validates the header bytes of a NAT - PMP response .
func checkHeader(b []byte, op int) error {
	if len(b) < 4 {
		return io.ErrUnexpectedEOF
	}
	if b[0] != Version {
		return fmt.Errorf("natpmp: unexpected protocol version: %d: %w", b[0], ErrProtocol)
	}
	if int(b[1]) != op {
		return fmt.Errorf("natpmp: unexpected response opcode: %d != %d: %w", b[1], op, ErrProtocol)
	}
	if err := Error(binary.BigEndian.Uint16(b[2:4])); err != success {
		return err
	}
	return nil
}
func checkHeader ( b [ ] byte , op int ) error { if len ( b ) < 4 { return io . ErrUnexpectedEOF } if b [ 0 ] != Version { return fmt . Errorf ( " " , b [ 0 ] , ErrProtocol ) } if int ( b [ 1 ] ) != op { return fmt . Errorf ( " " , b [ 1 ] , op , ErrProtocol ) } if err := Error ( binary . BigEndian . Uint16 ( b [ 2 : 4 ] ) ) ; err != success { return err } return nil }
checkHeader validates the header bytes of a NAT-PMP response.
checkHeader validates the header bytes of a NAT - PMP response .
// Any non-zero value is an error and is wrapped in our Error type.