proxy

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout    = 5 * time.Second
	DefaultServerPort = 7654
)

Variables

This section is empty.

Functions

func ServeProxy

func ServeProxy(ctx context.Context, ln net.Listener, c ProxyConfig) error

func StartProxy

func StartProxy(ctx context.Context, addr string, c ProxyConfig) error

func StartServer

func StartServer(addr string, timeout time.Duration, allowedUpstreams []string) error

func StartTcpForward

func StartTcpForward(ctx context.Context, addr string, c TcpForwardConfig) error

Types

type ProxyConfig

type ProxyConfig struct {
	Rules   []Rule        `yaml:"rules"`
	Timeout time.Duration `yaml:"dial_timeout"`
}

type Rule

type Rule struct {
	Tunnel    Tunnel   `yaml:"tunnel"`
	Upstreams []string `yaml:"upstreams"`
}

type TcpForwardConfig

type TcpForwardConfig struct {
	ServiceUrl     string
	ServiceAccount string
	Instance       string
	Port           int
	Project        string
	Zone           string
	Upstream       string
	MuxEnabled     bool
}

type Tunnel

type Tunnel struct {
	Instance       string `yaml:"instance"`
	Port           int    `yaml:"port"`
	Project        string `yaml:"project"`
	Zone           string `yaml:"zone"`
	ServiceUrl     string `yaml:"service_url"`
	ServiceAccount string `yaml:"service_account"`
	MuxEnabled     bool   `yaml:"mux"`
}

Jump to

Keyboard shortcuts

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