proto

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_p2p_proto_p2p_proto protoreflect.FileDescriptor
View Source
var P2P_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.P2P",
	HandlerType: (*P2PServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "OpenTunnel",
			Handler:    _P2P_OpenTunnel_Handler,
		},
		{
			MethodName: "Status",
			Handler:    _P2P_Status_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Tunnel",
			Handler:       _P2P_Tunnel_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "p2p/proto/p2p.proto",
}

P2P_ServiceDesc is the grpc.ServiceDesc for P2P service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterP2PServer

func RegisterP2PServer(s grpc.ServiceRegistrar, srv P2PServer)

Types

type Chunk added in v0.8.0

type Chunk struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

Chunk is one frame of a Tunnel byte stream.

func (*Chunk) Descriptor deprecated added in v0.8.0

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

Deprecated: Use Chunk.ProtoReflect.Descriptor instead.

func (*Chunk) GetData added in v0.8.0

func (x *Chunk) GetData() []byte

func (*Chunk) ProtoMessage added in v0.8.0

func (*Chunk) ProtoMessage()

func (*Chunk) ProtoReflect added in v0.8.0

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

func (*Chunk) Reset added in v0.8.0

func (x *Chunk) Reset()

func (*Chunk) String added in v0.8.0

func (x *Chunk) String() string

type OpenTunnelReply

type OpenTunnelReply struct {
	Ok    bool   `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
	Id    string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` // human-readable reason when ok == false
	// contains filtered or unexported fields
}

id is assigned by the server; the client must present it as the "id" metadata key on the Tunnel stream. It is the stream's credential and must be unguessable and treated as a secret.

func (*OpenTunnelReply) Descriptor deprecated

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

Deprecated: Use OpenTunnelReply.ProtoReflect.Descriptor instead.

func (*OpenTunnelReply) GetError

func (x *OpenTunnelReply) GetError() string

func (*OpenTunnelReply) GetId

func (x *OpenTunnelReply) GetId() string

func (*OpenTunnelReply) GetOk

func (x *OpenTunnelReply) GetOk() bool

func (*OpenTunnelReply) ProtoMessage

func (*OpenTunnelReply) ProtoMessage()

func (*OpenTunnelReply) ProtoReflect

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

func (*OpenTunnelReply) Reset

func (x *OpenTunnelReply) Reset()

func (*OpenTunnelReply) String

func (x *OpenTunnelReply) String() string

type OpenTunnelRequest

type OpenTunnelRequest struct {
	Peer string `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"`
	// network selects the tunnel's semantics: "tcp" (a byte stream; empty
	// means tcp) or "udp" (a datagram stream, one datagram per frame).
	// Values are validated by the plugin.
	Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"`
	// contains filtered or unexported fields
}

OpenTunnel asks the plugin to authorize a tunnel to the given peer and allocate the id that binds the Tunnel data stream to it.

peer is opaque to the client: its semantics are defined by the plugin itself (rendezvous capability ID, WG public key, custom credential...). The client only passes it through.

func (*OpenTunnelRequest) Descriptor deprecated

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

Deprecated: Use OpenTunnelRequest.ProtoReflect.Descriptor instead.

func (*OpenTunnelRequest) GetNetwork added in v0.7.0

func (x *OpenTunnelRequest) GetNetwork() string

func (*OpenTunnelRequest) GetPeer

func (x *OpenTunnelRequest) GetPeer() string

func (*OpenTunnelRequest) ProtoMessage

func (*OpenTunnelRequest) ProtoMessage()

func (*OpenTunnelRequest) ProtoReflect

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

func (*OpenTunnelRequest) Reset

func (x *OpenTunnelRequest) Reset()

func (*OpenTunnelRequest) String

func (x *OpenTunnelRequest) String() string

type P2PClient

type P2PClient interface {
	OpenTunnel(ctx context.Context, in *OpenTunnelRequest, opts ...grpc.CallOption) (*OpenTunnelReply, error)
	// Tunnel carries the tunnel's data; the server binds the stream to the
	// tunnel named by the "id" gRPC metadata key issued by OpenTunnel. The
	// stream's lifetime IS the tunnel's lifetime: the stream ending
	// (EOF/error, or the server handler returning) tears the tunnel down.
	Tunnel(ctx context.Context, opts ...grpc.CallOption) (P2P_TunnelClient, error)
	Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error)
}

P2PClient is the client API for P2P service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewP2PClient

func NewP2PClient(cc grpc.ClientConnInterface) P2PClient

type P2PServer

type P2PServer interface {
	OpenTunnel(context.Context, *OpenTunnelRequest) (*OpenTunnelReply, error)
	// Tunnel carries the tunnel's data; the server binds the stream to the
	// tunnel named by the "id" gRPC metadata key issued by OpenTunnel. The
	// stream's lifetime IS the tunnel's lifetime: the stream ending
	// (EOF/error, or the server handler returning) tears the tunnel down.
	Tunnel(P2P_TunnelServer) error
	Status(context.Context, *StatusRequest) (*StatusReply, error)
	// contains filtered or unexported methods
}

P2PServer is the server API for P2P service. All implementations must embed UnimplementedP2PServer for forward compatibility

type P2P_TunnelClient added in v0.8.0

type P2P_TunnelClient interface {
	Send(*Chunk) error
	Recv() (*Chunk, error)
	grpc.ClientStream
}

type P2P_TunnelServer added in v0.8.0

type P2P_TunnelServer interface {
	Send(*Chunk) error
	Recv() (*Chunk, error)
	grpc.ServerStream
}

type StatusReply

type StatusReply struct {
	Tunnels       int32 `protobuf:"varint,1,opt,name=tunnels,proto3" json:"tunnels,omitempty"`                                  // active inbound tunnels held by this host
	DirectPeers   int32 `protobuf:"varint,2,opt,name=direct_peers,json=directPeers,proto3" json:"direct_peers,omitempty"`       // gauge: peers with a live direct session
	DerpPeers     int32 `protobuf:"varint,3,opt,name=derp_peers,json=derpPeers,proto3" json:"derp_peers,omitempty"`             // gauge: peers on relay only (no live direct)
	PunchAttempts int64 `protobuf:"varint,4,opt,name=punch_attempts,json=punchAttempts,proto3" json:"punch_attempts,omitempty"` // counter
	PunchSuccess  int64 `protobuf:"varint,5,opt,name=punch_success,json=punchSuccess,proto3" json:"punch_success,omitempty"`    // counter: attempts that reached direct
	StreamsDirect int64 `protobuf:"varint,6,opt,name=streams_direct,json=streamsDirect,proto3" json:"streams_direct,omitempty"` // counter
	StreamsDerp   int64 `protobuf:"varint,7,opt,name=streams_derp,json=streamsDerp,proto3" json:"streams_derp,omitempty"`       // counter
	// contains filtered or unexported fields
}

Gauges describe the current path per peer; counters are cumulative since start. punch_attempts rising with punch_success flat distinguishes "punched and failed" from "punching never applied here".

func (*StatusReply) Descriptor deprecated

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

Deprecated: Use StatusReply.ProtoReflect.Descriptor instead.

func (*StatusReply) GetDerpPeers added in v0.8.1

func (x *StatusReply) GetDerpPeers() int32

func (*StatusReply) GetDirectPeers added in v0.8.1

func (x *StatusReply) GetDirectPeers() int32

func (*StatusReply) GetPunchAttempts added in v0.8.1

func (x *StatusReply) GetPunchAttempts() int64

func (*StatusReply) GetPunchSuccess added in v0.8.1

func (x *StatusReply) GetPunchSuccess() int64

func (*StatusReply) GetStreamsDerp added in v0.8.1

func (x *StatusReply) GetStreamsDerp() int64

func (*StatusReply) GetStreamsDirect added in v0.8.1

func (x *StatusReply) GetStreamsDirect() int64

func (*StatusReply) GetTunnels

func (x *StatusReply) GetTunnels() int32

func (*StatusReply) ProtoMessage

func (*StatusReply) ProtoMessage()

func (*StatusReply) ProtoReflect

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

func (*StatusReply) Reset

func (x *StatusReply) Reset()

func (*StatusReply) String

func (x *StatusReply) String() string

type StatusRequest

type StatusRequest struct {
	// contains filtered or unexported fields
}

func (*StatusRequest) Descriptor deprecated

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

Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.

func (*StatusRequest) ProtoMessage

func (*StatusRequest) ProtoMessage()

func (*StatusRequest) ProtoReflect

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

func (*StatusRequest) Reset

func (x *StatusRequest) Reset()

func (*StatusRequest) String

func (x *StatusRequest) String() string

type UnimplementedP2PServer

type UnimplementedP2PServer struct {
}

UnimplementedP2PServer must be embedded to have forward compatible implementations.

func (UnimplementedP2PServer) OpenTunnel

func (UnimplementedP2PServer) Status

func (UnimplementedP2PServer) Tunnel added in v0.8.0

type UnsafeP2PServer

type UnsafeP2PServer interface {
	// contains filtered or unexported methods
}

UnsafeP2PServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to P2PServer will result in compilation errors.

Jump to

Keyboard shortcuts

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