proto

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2023 License: Apache-2.0, BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_discover_proto_message_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type DiscoveryRequest

type DiscoveryRequest struct {

	// unix time
	Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*DiscoveryRequest) Descriptor deprecated

func (*DiscoveryRequest) Descriptor() ([]byte, []int)

Deprecated: Use DiscoveryRequest.ProtoReflect.Descriptor instead.

func (*DiscoveryRequest) GetTimestamp

func (x *DiscoveryRequest) GetTimestamp() int64

func (*DiscoveryRequest) Name

func (x *DiscoveryRequest) Name() string

func (*DiscoveryRequest) ProtoMessage

func (*DiscoveryRequest) ProtoMessage()

func (*DiscoveryRequest) ProtoReflect

func (x *DiscoveryRequest) ProtoReflect() protoreflect.Message

func (*DiscoveryRequest) Reset

func (x *DiscoveryRequest) Reset()

func (*DiscoveryRequest) String

func (x *DiscoveryRequest) String() string

func (*DiscoveryRequest) Type

func (x *DiscoveryRequest) Type() MType

type DiscoveryResponse

type DiscoveryResponse struct {

	// hash of the corresponding request
	ReqHash []byte `protobuf:"bytes,1,opt,name=req_hash,json=reqHash,proto3" json:"req_hash,omitempty"`
	// list of peers
	Peers []*proto1.Peer `protobuf:"bytes,2,rep,name=peers,proto3" json:"peers,omitempty"`
	// contains filtered or unexported fields
}

func (*DiscoveryResponse) Descriptor deprecated

func (*DiscoveryResponse) Descriptor() ([]byte, []int)

Deprecated: Use DiscoveryResponse.ProtoReflect.Descriptor instead.

func (*DiscoveryResponse) GetPeers

func (x *DiscoveryResponse) GetPeers() []*proto1.Peer

func (*DiscoveryResponse) GetReqHash

func (x *DiscoveryResponse) GetReqHash() []byte

func (*DiscoveryResponse) Name

func (x *DiscoveryResponse) Name() string

func (*DiscoveryResponse) ProtoMessage

func (*DiscoveryResponse) ProtoMessage()

func (*DiscoveryResponse) ProtoReflect

func (x *DiscoveryResponse) ProtoReflect() protoreflect.Message

func (*DiscoveryResponse) Reset

func (x *DiscoveryResponse) Reset()

func (*DiscoveryResponse) String

func (x *DiscoveryResponse) String() string

func (*DiscoveryResponse) Type

func (x *DiscoveryResponse) Type() MType

type MType

type MType = server.MType

MType is the type of message type enum.

const (
	MPing MType = 10 + iota
	MPong
	MDiscoveryRequest
	MDiscoveryResponse
)

An enum for the different message types.

type Message

type Message interface {
	proto.Message

	// Name returns the name of the corresponding message type for debugging.
	Name() string
	// Type returns the type of the corresponding message as an enum.
	Type() MType
}

Message extends the proto.Message interface with additional util functions.

type Ping

type Ping struct {

	// version number and network ID to classify the protocol
	Version   uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	NetworkId uint32 `protobuf:"varint,2,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"`
	// unix time
	Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// endpoint of the sender; port and string form of the return IP address (e.g. "192.0.2.1", "[2001:db8::1]")
	SrcAddr string `protobuf:"bytes,4,opt,name=src_addr,json=srcAddr,proto3" json:"src_addr,omitempty"`
	SrcPort uint32 `protobuf:"varint,5,opt,name=src_port,json=srcPort,proto3" json:"src_port,omitempty"`
	// string form of receiver's IP
	// This provides a way to discover the the external address (after NAT).
	DstAddr string `protobuf:"bytes,6,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"`
	// contains filtered or unexported fields
}

func (*Ping) Descriptor deprecated

func (*Ping) Descriptor() ([]byte, []int)

Deprecated: Use Ping.ProtoReflect.Descriptor instead.

func (*Ping) GetDstAddr

func (x *Ping) GetDstAddr() string

func (*Ping) GetNetworkId

func (x *Ping) GetNetworkId() uint32

func (*Ping) GetSrcAddr

func (x *Ping) GetSrcAddr() string

func (*Ping) GetSrcPort

func (x *Ping) GetSrcPort() uint32

func (*Ping) GetTimestamp

func (x *Ping) GetTimestamp() int64

func (*Ping) GetVersion

func (x *Ping) GetVersion() uint32

func (*Ping) Name

func (x *Ping) Name() string

func (*Ping) ProtoMessage

func (*Ping) ProtoMessage()

func (*Ping) ProtoReflect

func (x *Ping) ProtoReflect() protoreflect.Message

func (*Ping) Reset

func (x *Ping) Reset()

func (*Ping) String

func (x *Ping) String() string

func (*Ping) Type

func (x *Ping) Type() MType

type Pong

type Pong struct {

	// hash of the ping packet
	ReqHash []byte `protobuf:"bytes,1,opt,name=req_hash,json=reqHash,proto3" json:"req_hash,omitempty"`
	// services supported by the sender
	Services *proto.ServiceMap `protobuf:"bytes,2,opt,name=services,proto3" json:"services,omitempty"`
	// string form of receiver's IP
	// This should mirror the source IP of the Ping's IP packet. It provides a way to discover the the external address (after NAT).
	DstAddr string `protobuf:"bytes,3,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"`
	// contains filtered or unexported fields
}

func (*Pong) Descriptor deprecated

func (*Pong) Descriptor() ([]byte, []int)

Deprecated: Use Pong.ProtoReflect.Descriptor instead.

func (*Pong) GetDstAddr

func (x *Pong) GetDstAddr() string

func (*Pong) GetReqHash

func (x *Pong) GetReqHash() []byte

func (*Pong) GetServices

func (x *Pong) GetServices() *proto.ServiceMap

func (*Pong) Name

func (x *Pong) Name() string

func (*Pong) ProtoMessage

func (*Pong) ProtoMessage()

func (*Pong) ProtoReflect

func (x *Pong) ProtoReflect() protoreflect.Message

func (*Pong) Reset

func (x *Pong) Reset()

func (*Pong) String

func (x *Pong) String() string

func (*Pong) Type

func (x *Pong) Type() MType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL