mirror of https://github.com/libp2p/go-libp2p.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
414 lines
10 KiB
414 lines
10 KiB
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
// source: holepunch.proto
|
|
|
|
package holepunch_pb
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/gogo/protobuf/proto"
|
|
io "io"
|
|
math "math"
|
|
math_bits "math/bits"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
type HolePunch_Type int32
|
|
|
|
const (
|
|
HolePunch_CONNECT HolePunch_Type = 100
|
|
HolePunch_SYNC HolePunch_Type = 300
|
|
)
|
|
|
|
var HolePunch_Type_name = map[int32]string{
|
|
100: "CONNECT",
|
|
300: "SYNC",
|
|
}
|
|
|
|
var HolePunch_Type_value = map[string]int32{
|
|
"CONNECT": 100,
|
|
"SYNC": 300,
|
|
}
|
|
|
|
func (x HolePunch_Type) Enum() *HolePunch_Type {
|
|
p := new(HolePunch_Type)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x HolePunch_Type) String() string {
|
|
return proto.EnumName(HolePunch_Type_name, int32(x))
|
|
}
|
|
|
|
func (x *HolePunch_Type) UnmarshalJSON(data []byte) error {
|
|
value, err := proto.UnmarshalJSONEnum(HolePunch_Type_value, data, "HolePunch_Type")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*x = HolePunch_Type(value)
|
|
return nil
|
|
}
|
|
|
|
func (HolePunch_Type) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_290ddea0f23ef64a, []int{0, 0}
|
|
}
|
|
|
|
type HolePunch struct {
|
|
Type *HolePunch_Type `protobuf:"varint,1,opt,name=type,enum=holepunch.pb.HolePunch_Type" json:"type,omitempty"`
|
|
// For hole punching, we'll send some additional observed addresses to the remote peer
|
|
// that could have been filtered by the Host address factory (for example: AutoRelay removes all public addresses if peer has private reachability).
|
|
// This is a hack!
|
|
// We plan to have a better address discovery and advertisement mechanism in the future.
|
|
// See https://github.com/libp2p/go-libp2p-autonat/pull/98
|
|
ObsAddrs [][]byte `protobuf:"bytes,2,rep,name=ObsAddrs" json:"ObsAddrs,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *HolePunch) Reset() { *m = HolePunch{} }
|
|
func (m *HolePunch) String() string { return proto.CompactTextString(m) }
|
|
func (*HolePunch) ProtoMessage() {}
|
|
func (*HolePunch) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_290ddea0f23ef64a, []int{0}
|
|
}
|
|
func (m *HolePunch) XXX_Unmarshal(b []byte) error {
|
|
return m.Unmarshal(b)
|
|
}
|
|
func (m *HolePunch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
if deterministic {
|
|
return xxx_messageInfo_HolePunch.Marshal(b, m, deterministic)
|
|
} else {
|
|
b = b[:cap(b)]
|
|
n, err := m.MarshalToSizedBuffer(b)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return b[:n], nil
|
|
}
|
|
}
|
|
func (m *HolePunch) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_HolePunch.Merge(m, src)
|
|
}
|
|
func (m *HolePunch) XXX_Size() int {
|
|
return m.Size()
|
|
}
|
|
func (m *HolePunch) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_HolePunch.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_HolePunch proto.InternalMessageInfo
|
|
|
|
func (m *HolePunch) GetType() HolePunch_Type {
|
|
if m != nil && m.Type != nil {
|
|
return *m.Type
|
|
}
|
|
return HolePunch_CONNECT
|
|
}
|
|
|
|
func (m *HolePunch) GetObsAddrs() [][]byte {
|
|
if m != nil {
|
|
return m.ObsAddrs
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterEnum("holepunch.pb.HolePunch_Type", HolePunch_Type_name, HolePunch_Type_value)
|
|
proto.RegisterType((*HolePunch)(nil), "holepunch.pb.HolePunch")
|
|
}
|
|
|
|
func init() { proto.RegisterFile("holepunch.proto", fileDescriptor_290ddea0f23ef64a) }
|
|
|
|
var fileDescriptor_290ddea0f23ef64a = []byte{
|
|
// 153 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcf, 0xc8, 0xcf, 0x49,
|
|
0x2d, 0x28, 0xcd, 0x4b, 0xce, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x41, 0x12, 0x48,
|
|
0x52, 0xaa, 0xe4, 0xe2, 0xf4, 0xc8, 0xcf, 0x49, 0x0d, 0x00, 0xf1, 0x85, 0x0c, 0xb8, 0x58, 0x4a,
|
|
0x2a, 0x0b, 0x52, 0x25, 0x18, 0x15, 0x18, 0x35, 0xf8, 0x8c, 0x64, 0xf4, 0x90, 0x55, 0xea, 0xc1,
|
|
0x95, 0xe9, 0x85, 0x54, 0x16, 0xa4, 0x06, 0x81, 0x55, 0x0a, 0x49, 0x71, 0x71, 0xf8, 0x27, 0x15,
|
|
0x3b, 0xa6, 0xa4, 0x14, 0x15, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0xf0, 0x04, 0xc1, 0xf9, 0x4a, 0x72,
|
|
0x5c, 0x2c, 0x20, 0x95, 0x42, 0xdc, 0x5c, 0xec, 0xce, 0xfe, 0x7e, 0x7e, 0xae, 0xce, 0x21, 0x02,
|
|
0x29, 0x42, 0x9c, 0x5c, 0x2c, 0xc1, 0x91, 0x7e, 0xce, 0x02, 0x6b, 0x98, 0x9c, 0x78, 0x4e, 0x3c,
|
|
0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0x46, 0x40, 0x00, 0x00, 0x00, 0xff,
|
|
0xff, 0x62, 0xf4, 0xc8, 0x7c, 0xa8, 0x00, 0x00, 0x00,
|
|
}
|
|
|
|
func (m *HolePunch) Marshal() (dAtA []byte, err error) {
|
|
size := m.Size()
|
|
dAtA = make([]byte, size)
|
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return dAtA[:n], nil
|
|
}
|
|
|
|
func (m *HolePunch) MarshalTo(dAtA []byte) (int, error) {
|
|
size := m.Size()
|
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
}
|
|
|
|
func (m *HolePunch) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
i := len(dAtA)
|
|
_ = i
|
|
var l int
|
|
_ = l
|
|
if m.XXX_unrecognized != nil {
|
|
i -= len(m.XXX_unrecognized)
|
|
copy(dAtA[i:], m.XXX_unrecognized)
|
|
}
|
|
if len(m.ObsAddrs) > 0 {
|
|
for iNdEx := len(m.ObsAddrs) - 1; iNdEx >= 0; iNdEx-- {
|
|
i -= len(m.ObsAddrs[iNdEx])
|
|
copy(dAtA[i:], m.ObsAddrs[iNdEx])
|
|
i = encodeVarintHolepunch(dAtA, i, uint64(len(m.ObsAddrs[iNdEx])))
|
|
i--
|
|
dAtA[i] = 0x12
|
|
}
|
|
}
|
|
if m.Type != nil {
|
|
i = encodeVarintHolepunch(dAtA, i, uint64(*m.Type))
|
|
i--
|
|
dAtA[i] = 0x8
|
|
}
|
|
return len(dAtA) - i, nil
|
|
}
|
|
|
|
func encodeVarintHolepunch(dAtA []byte, offset int, v uint64) int {
|
|
offset -= sovHolepunch(v)
|
|
base := offset
|
|
for v >= 1<<7 {
|
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
|
v >>= 7
|
|
offset++
|
|
}
|
|
dAtA[offset] = uint8(v)
|
|
return base
|
|
}
|
|
func (m *HolePunch) Size() (n int) {
|
|
if m == nil {
|
|
return 0
|
|
}
|
|
var l int
|
|
_ = l
|
|
if m.Type != nil {
|
|
n += 1 + sovHolepunch(uint64(*m.Type))
|
|
}
|
|
if len(m.ObsAddrs) > 0 {
|
|
for _, b := range m.ObsAddrs {
|
|
l = len(b)
|
|
n += 1 + l + sovHolepunch(uint64(l))
|
|
}
|
|
}
|
|
if m.XXX_unrecognized != nil {
|
|
n += len(m.XXX_unrecognized)
|
|
}
|
|
return n
|
|
}
|
|
|
|
func sovHolepunch(x uint64) (n int) {
|
|
return (math_bits.Len64(x|1) + 6) / 7
|
|
}
|
|
func sozHolepunch(x uint64) (n int) {
|
|
return sovHolepunch(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
}
|
|
func (m *HolePunch) Unmarshal(dAtA []byte) error {
|
|
l := len(dAtA)
|
|
iNdEx := 0
|
|
for iNdEx < l {
|
|
preIndex := iNdEx
|
|
var wire uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowHolepunch
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := dAtA[iNdEx]
|
|
iNdEx++
|
|
wire |= uint64(b&0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
fieldNum := int32(wire >> 3)
|
|
wireType := int(wire & 0x7)
|
|
if wireType == 4 {
|
|
return fmt.Errorf("proto: HolePunch: wiretype end group for non-group")
|
|
}
|
|
if fieldNum <= 0 {
|
|
return fmt.Errorf("proto: HolePunch: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
}
|
|
switch fieldNum {
|
|
case 1:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
|
|
}
|
|
var v HolePunch_Type
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowHolepunch
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := dAtA[iNdEx]
|
|
iNdEx++
|
|
v |= HolePunch_Type(b&0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
m.Type = &v
|
|
case 2:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field ObsAddrs", wireType)
|
|
}
|
|
var byteLen int
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowHolepunch
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := dAtA[iNdEx]
|
|
iNdEx++
|
|
byteLen |= int(b&0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
if byteLen < 0 {
|
|
return ErrInvalidLengthHolepunch
|
|
}
|
|
postIndex := iNdEx + byteLen
|
|
if postIndex < 0 {
|
|
return ErrInvalidLengthHolepunch
|
|
}
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
m.ObsAddrs = append(m.ObsAddrs, make([]byte, postIndex-iNdEx))
|
|
copy(m.ObsAddrs[len(m.ObsAddrs)-1], dAtA[iNdEx:postIndex])
|
|
iNdEx = postIndex
|
|
default:
|
|
iNdEx = preIndex
|
|
skippy, err := skipHolepunch(dAtA[iNdEx:])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if skippy < 0 {
|
|
return ErrInvalidLengthHolepunch
|
|
}
|
|
if (iNdEx + skippy) < 0 {
|
|
return ErrInvalidLengthHolepunch
|
|
}
|
|
if (iNdEx + skippy) > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
iNdEx += skippy
|
|
}
|
|
}
|
|
|
|
if iNdEx > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
return nil
|
|
}
|
|
func skipHolepunch(dAtA []byte) (n int, err error) {
|
|
l := len(dAtA)
|
|
iNdEx := 0
|
|
depth := 0
|
|
for iNdEx < l {
|
|
var wire uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return 0, ErrIntOverflowHolepunch
|
|
}
|
|
if iNdEx >= l {
|
|
return 0, io.ErrUnexpectedEOF
|
|
}
|
|
b := dAtA[iNdEx]
|
|
iNdEx++
|
|
wire |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
wireType := int(wire & 0x7)
|
|
switch wireType {
|
|
case 0:
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return 0, ErrIntOverflowHolepunch
|
|
}
|
|
if iNdEx >= l {
|
|
return 0, io.ErrUnexpectedEOF
|
|
}
|
|
iNdEx++
|
|
if dAtA[iNdEx-1] < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 1:
|
|
iNdEx += 8
|
|
case 2:
|
|
var length int
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return 0, ErrIntOverflowHolepunch
|
|
}
|
|
if iNdEx >= l {
|
|
return 0, io.ErrUnexpectedEOF
|
|
}
|
|
b := dAtA[iNdEx]
|
|
iNdEx++
|
|
length |= (int(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
if length < 0 {
|
|
return 0, ErrInvalidLengthHolepunch
|
|
}
|
|
iNdEx += length
|
|
case 3:
|
|
depth++
|
|
case 4:
|
|
if depth == 0 {
|
|
return 0, ErrUnexpectedEndOfGroupHolepunch
|
|
}
|
|
depth--
|
|
case 5:
|
|
iNdEx += 4
|
|
default:
|
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
|
}
|
|
if iNdEx < 0 {
|
|
return 0, ErrInvalidLengthHolepunch
|
|
}
|
|
if depth == 0 {
|
|
return iNdEx, nil
|
|
}
|
|
}
|
|
return 0, io.ErrUnexpectedEOF
|
|
}
|
|
|
|
var (
|
|
ErrInvalidLengthHolepunch = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
ErrIntOverflowHolepunch = fmt.Errorf("proto: integer overflow")
|
|
ErrUnexpectedEndOfGroupHolepunch = fmt.Errorf("proto: unexpected end of group")
|
|
)
|
|
|