Documentation ¶
Overview ¶
Package wggrpc provides a WireGuard over GRPC client and server implementation.
Index ¶
Constants ¶
const PeerAddrKey = "x-siderolink-ipv6-addr"
PeerAddrKey is the key used to store the peer address in the grpc context.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowedPeers ¶
type AllowedPeers struct {
// contains filtered or unexported fields
}
AllowedPeers is a list of allowed peers. Currently, PeerAddrKey netip.Addr value is used as a token.
func NewAllowedPeers ¶
func NewAllowedPeers() *AllowedPeers
NewAllowedPeers creates a new allowed peers list.
func (*AllowedPeers) AddToken ¶
func (p *AllowedPeers) AddToken(pubKey wgtypes.Key, token string)
AddToken adds the peer to the allowed list.
func (*AllowedPeers) CheckToken ¶
func (p *AllowedPeers) CheckToken(token string) bool
CheckToken checks if the token is allowed.
func (*AllowedPeers) RemoveToken ¶
func (p *AllowedPeers) RemoveToken(pubKey wgtypes.Key)
RemoveToken removes the peer from the allowed list.
type Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
Relay is the client side of the WireGuard over GRPC relay.
func NewRelay ¶
func NewRelay(conn *grpc.ClientConn, retryTimeout time.Duration, queues *wgbind.QueuePair, ourAddr netip.AddrPort) *Relay
NewRelay creates a new Relay.
func NewRelayToHost ¶
func NewRelayToHost(host string, retryTimeout time.Duration, queues *wgbind.QueuePair, ourAddr netip.AddrPort, opts ...grpc.DialOption) (*Relay, error)
NewRelayToHost creates a new Relay.
type Service ¶
type Service struct { pb.UnimplementedWireGuardOverGRPCServiceServer // contains filtered or unexported fields }
Service is the gRPC service responsible for handling WireGuard over GRPC traffic.
func NewService ¶
func NewService(pt *wgbind.PeerTraffic, allowed *AllowedPeers, logger *zap.Logger) *Service
NewService creates a new WireGuard over GRPC service.
func (*Service) CreateStream ¶
func (s *Service) CreateStream(srv pb.WireGuardOverGRPCService_CreateStreamServer) error
CreateStream implements pb.WireGuardOverGRPCServiceServer.