goclient

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Connection

type Connection struct {
	*grpc.ClientConn
	Tunnel *WireGuardTunnel // nil for non-WireGuard connections
}

Connection wraps a gRPC connection with optional WireGuard tunnel

func Connect

func Connect(serverURL string) (*Connection, error)

Connect establishes a gRPC connection to the server. serverURL can be "host:port", "https://host", or "https://user:pass@host".

func ConnectWithWireGuard

func ConnectWithWireGuard(serverAddr string, wgConfigPath string) (*Connection, error)

ConnectWithWireGuard establishes a gRPC connection through a WireGuard tunnel

func (*Connection) Close

func (c *Connection) Close() error

Close closes the connection and tunnel if present

type WireGuardConfig

type WireGuardConfig struct {
	PrivateKey    string     // client's WireGuard private key (base64)
	Address       netip.Addr // client's IP in the WireGuard network
	PeerPublicKey string     // server's WireGuard public key (base64)
	Endpoint      string     // WireGuard endpoint (host:port)
}

WireGuardConfig holds the configuration for a WireGuard tunnel

func ParseWireGuardConfig

func ParseWireGuardConfig(path string) (*WireGuardConfig, error)

ParseWireGuardConfig parses a standard WireGuard config file

type WireGuardTunnel

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

WireGuardTunnel represents an active userspace WireGuard tunnel

func ConnectViaWireGuard

func ConnectViaWireGuard(serverAddr string, wgCfg *WireGuardConfig) (*grpc.ClientConn, *WireGuardTunnel, error)

ConnectViaWireGuard creates a gRPC connection through a WireGuard tunnel

func NewWireGuardTunnel

func NewWireGuardTunnel(cfg *WireGuardConfig) (*WireGuardTunnel, error)

NewWireGuardTunnel creates a new userspace WireGuard tunnel

func (*WireGuardTunnel) Close

func (t *WireGuardTunnel) Close() error

Close shuts down the WireGuard tunnel

func (*WireGuardTunnel) Dial

func (t *WireGuardTunnel) Dial(ctx context.Context, address string) (net.Conn, error)

Dial creates a TCP connection through the WireGuard tunnel

Jump to

Keyboard shortcuts

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