tun

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConnectAddress = "ws://127.0.0.1:8080/stream"
)

default client options

View Source
var (
	DefaultListenAddress = "ws://0.0.0.0:8080/stream"
)

default server options

View Source
var (
	NewClient = newWsClient
)

default client

View Source
var (
	NewServer = newWsServer
)

default server

Functions

This section is empty.

Types

type Addr

type Addr interface {
	String() string
}

Addr is tunnel address

type Client

type Client interface {
	DialAndServe(ctx context.Context, h Handler) error
}

Client is tunnel client

type ClientOption

type ClientOption func(*ClientOptions)

ClientOption is option setter for client

func WithConnectAddress

func WithConnectAddress(addr string) ClientOption

WithConnectAddress sets client connect address opt

type ClientOptions

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

ClientOptions is client options

type ConnIDContextKey added in v0.2.0

type ConnIDContextKey struct{}

ConnIDContextKey is context key of connID

type Handler

type Handler interface {
	ServeTun(ctx context.Context, r io.Reader, w io.Writer)
}

Handler is tunnel handler

type Server

type Server interface {
	ListenAndServe(ctx context.Context, h Handler) error
}

Server is tunnel server

type ServerOption

type ServerOption func(*ServerOptions)

ServerOption is option setter for server

func WithListenAddress

func WithListenAddress(addr string) ServerOption

WithListenAddress sets server listen address opt

type ServerOptions

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

ServerOptions is server options

Jump to

Keyboard shortcuts

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