proto

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 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 PeerDiagnostic added in v0.10.0

type PeerDiagnostic struct {
	Peer          string   `protobuf:"bytes,14,opt,name=peer,proto3" json:"peer,omitempty"`
	Path          string   `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	Reason        string   `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
	State         string   `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"`
	Failed        bool     `protobuf:"varint,4,opt,name=failed,proto3" json:"failed,omitempty"`
	LastError     string   `protobuf:"bytes,5,opt,name=last_error,json=lastError,proto3" json:"last_error,omitempty"`
	PeerAddr      string   `protobuf:"bytes,6,opt,name=peer_addr,json=peerAddr,proto3" json:"peer_addr,omitempty"`
	Candidates    int32    `protobuf:"varint,7,opt,name=candidates,proto3" json:"candidates,omitempty"`
	Caps          []string `protobuf:"bytes,8,rep,name=caps,proto3" json:"caps,omitempty"`
	SessionAgeMs  int64    `protobuf:"varint,9,opt,name=session_age_ms,json=sessionAgeMs,proto3" json:"session_age_ms,omitempty"`
	LastRecvAgeMs int64    `protobuf:"varint,10,opt,name=last_recv_age_ms,json=lastRecvAgeMs,proto3" json:"last_recv_age_ms,omitempty"`
	Attempts      int64    `protobuf:"varint,11,opt,name=attempts,proto3" json:"attempts,omitempty"`
	Ups           int64    `protobuf:"varint,12,opt,name=ups,proto3" json:"ups,omitempty"`
	Drops         int64    `protobuf:"varint,13,opt,name=drops,proto3" json:"drops,omitempty"`
	// trace is the peer's recent punch history: short human-readable lines,
	// oldest first (newest kept). Empty for a relay-only peer.
	Trace []string `protobuf:"bytes,15,rep,name=trace,proto3" json:"trace,omitempty"`
	// contains filtered or unexported fields
}

PeerDiagnostic is one connected peer's live state, as Status reports it. peer keys the entry: the list is repeated, so two peers with the same path would otherwise be byte-identical and unattributable.

func (*PeerDiagnostic) Descriptor deprecated added in v0.10.0

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

Deprecated: Use PeerDiagnostic.ProtoReflect.Descriptor instead.

func (*PeerDiagnostic) GetAttempts added in v0.10.0

func (x *PeerDiagnostic) GetAttempts() int64

func (*PeerDiagnostic) GetCandidates added in v0.10.0

func (x *PeerDiagnostic) GetCandidates() int32

func (*PeerDiagnostic) GetCaps added in v0.10.0

func (x *PeerDiagnostic) GetCaps() []string

func (*PeerDiagnostic) GetDrops added in v0.10.0

func (x *PeerDiagnostic) GetDrops() int64

func (*PeerDiagnostic) GetFailed added in v0.10.0

func (x *PeerDiagnostic) GetFailed() bool

func (*PeerDiagnostic) GetLastError added in v0.10.0

func (x *PeerDiagnostic) GetLastError() string

func (*PeerDiagnostic) GetLastRecvAgeMs added in v0.10.0

func (x *PeerDiagnostic) GetLastRecvAgeMs() int64

func (*PeerDiagnostic) GetPath added in v0.10.0

func (x *PeerDiagnostic) GetPath() string

func (*PeerDiagnostic) GetPeer added in v0.10.0

func (x *PeerDiagnostic) GetPeer() string

func (*PeerDiagnostic) GetPeerAddr added in v0.10.0

func (x *PeerDiagnostic) GetPeerAddr() string

func (*PeerDiagnostic) GetReason added in v0.10.0

func (x *PeerDiagnostic) GetReason() string

func (*PeerDiagnostic) GetSessionAgeMs added in v0.10.0

func (x *PeerDiagnostic) GetSessionAgeMs() int64

func (*PeerDiagnostic) GetState added in v0.10.0

func (x *PeerDiagnostic) GetState() string

func (*PeerDiagnostic) GetTrace added in v0.10.0

func (x *PeerDiagnostic) GetTrace() []string

func (*PeerDiagnostic) GetUps added in v0.10.0

func (x *PeerDiagnostic) GetUps() int64

func (*PeerDiagnostic) ProtoMessage added in v0.10.0

func (*PeerDiagnostic) ProtoMessage()

func (*PeerDiagnostic) ProtoReflect added in v0.10.0

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

func (*PeerDiagnostic) Reset added in v0.10.0

func (x *PeerDiagnostic) Reset()

func (*PeerDiagnostic) String added in v0.10.0

func (x *PeerDiagnostic) String() string

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
	EncryptedPeers  int32             `protobuf:"varint,8,opt,name=encrypted_peers,json=encryptedPeers,proto3" json:"encrypted_peers,omitempty"` // gauge: connected peers with an encrypted session
	PlaintextPeers  int32             `protobuf:"varint,9,opt,name=plaintext_peers,json=plaintextPeers,proto3" json:"plaintext_peers,omitempty"` // gauge: connected peers without one
	PeerDiagnostics []*PeerDiagnostic `protobuf:"bytes,10,rep,name=peer_diagnostics,json=peerDiagnostics,proto3" json:"peer_diagnostics,omitempty"`
	// relay_connected reports whether the relay transport holds a live
	// connection, and relay_error the last dial failure (empty while
	// connected). A live direct session keeps every counter healthy while the
	// relay is down, so these are the only fields that can show an outage.
	RelayConnected bool   `protobuf:"varint,16,opt,name=relay_connected,json=relayConnected,proto3" json:"relay_connected,omitempty"`
	RelayError     string `protobuf:"bytes,17,opt,name=relay_error,json=relayError,proto3" json:"relay_error,omitempty"`
	// 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) GetEncryptedPeers added in v0.9.0

func (x *StatusReply) GetEncryptedPeers() int32

func (*StatusReply) GetPeerDiagnostics added in v0.10.0

func (x *StatusReply) GetPeerDiagnostics() []*PeerDiagnostic

func (*StatusReply) GetPlaintextPeers added in v0.9.0

func (x *StatusReply) GetPlaintextPeers() 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) GetRelayConnected added in v0.10.0

func (x *StatusReply) GetRelayConnected() bool

func (*StatusReply) GetRelayError added in v0.10.0

func (x *StatusReply) GetRelayError() string

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