route

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultHost = "localhost"

Variables

View Source
var (
	ImageNamePortMapTCP = map[string]int{
		"mssql":            1433,
		"mysql":            3306,
		"mariadb":          3306,
		"postgres":         5432,
		"rabbitmq":         5672,
		"redis":            6379,
		"memcached":        11211,
		"mongo":            27017,
		"minecraft-server": 25565,
	}

	ImageNamePortMapHTTP = map[string]int{
		"adguardhome":         3000,
		"bazarr":              6767,
		"calibre-web":         8083,
		"changedetection.io":  3000,
		"dockge":              5001,
		"gitea":               3000,
		"gogs":                3000,
		"grafana":             3000,
		"home-assistant":      8123,
		"homebridge":          8581,
		"httpd":               80,
		"immich":              3001,
		"jellyfin":            8096,
		"lidarr":              8686,
		"microbin":            8080,
		"nginx":               80,
		"nginx-proxy-manager": 81,
		"open-webui":          8080,
		"plex":                32400,
		"prometheus":          9090,
		"prowlarr":            9696,
		"radarr":              7878,
		"radarr-sma":          7878,
		"rsshub":              1200,
		"rss-bridge":          80,
		"sonarr":              8989,
		"sonarr-sma":          8989,
		"uptime-kuma":         3001,
		"whisparr":            6969,
	}
	ImageNamePortMapHTTPS = map[string]int{
		"portainer-be": 9443,
		"portainer-ce": 9443,
	}
	AliasPortMapHTTP  = map[string]int{}
	AliasPortMapHTTPS = map[string]int{
		"portainer": 9443,
		"crafty":    8080,
	}
)

Functions

func NewStreamRoute

func NewStreamRoute(base *Route) (routes.Route, gperr.Error)

Types

type FileServer

type FileServer struct {
	*Route

	Health *monitor.FileServerHealthMonitor `json:"health"`
	// contains filtered or unexported fields
}

func NewFileServer

func NewFileServer(base *Route) (*FileServer, gperr.Error)

func (*FileServer) Finish

func (s *FileServer) Finish(reason any)

Finish implements task.TaskFinisher.

func (*FileServer) HealthMonitor

func (s *FileServer) HealthMonitor() health.HealthMonitor

func (*FileServer) ServeHTTP

func (s *FileServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler.

func (*FileServer) Start

func (s *FileServer) Start(parent task.Parent) gperr.Error

Start implements task.TaskStarter.

func (*FileServer) Task

func (s *FileServer) Task() *task.Task

type Metadata

type Metadata struct {
	/* Docker only */
	Container *docker.Container `json:"container,omitempty"`
	Provider  string            `json:"provider,omitempty"`

	// private fields
	LisURL   *net.URL `json:"lurl,omitempty"`
	ProxyURL *net.URL `json:"purl,omitempty"`
	// contains filtered or unexported fields
}

type ReveseProxyRoute

type ReveseProxyRoute struct {
	*Route

	HealthMon health.HealthMonitor `json:"health,omitempty"`
	// contains filtered or unexported fields
}

func NewReverseProxyRoute

func NewReverseProxyRoute(base *Route) (*ReveseProxyRoute, gperr.Error)

func (*ReveseProxyRoute) Finish

func (r *ReveseProxyRoute) Finish(reason any)

Finish implements task.TaskFinisher.

func (*ReveseProxyRoute) HealthMonitor

func (r *ReveseProxyRoute) HealthMonitor() health.HealthMonitor

func (*ReveseProxyRoute) ServeHTTP

func (r *ReveseProxyRoute) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*ReveseProxyRoute) Start

func (r *ReveseProxyRoute) Start(parent task.Parent) gperr.Error

Start implements task.TaskStarter.

func (*ReveseProxyRoute) Task

func (r *ReveseProxyRoute) Task() *task.Task

Task implements task.TaskStarter.

type Route

type Route struct {
	Alias  string       `json:"alias"`
	Scheme route.Scheme `json:"scheme,omitempty"`
	Host   string       `json:"host,omitempty"`
	Port   route.Port   `json:"port,omitempty"`
	Root   string       `json:"root,omitempty"`

	route.HTTPConfig
	PathPatterns []string                       `json:"path_patterns,omitempty"`
	Rules        rules.Rules                    `json:"rules,omitempty" validate:"omitempty,unique=Name"`
	HealthCheck  *health.HealthCheckConfig      `json:"healthcheck,omitempty"`
	LoadBalance  *loadbalance.Config            `json:"load_balance,omitempty"`
	Middlewares  map[string]docker.LabelMap     `json:"middlewares,omitempty"`
	Homepage     *homepage.ItemConfig           `json:"homepage,omitempty"`
	AccessLog    *accesslog.RequestLoggerConfig `json:"access_log,omitempty"`

	Idlewatcher *idlewatcher.Config `json:"idlewatcher,omitempty"`

	Metadata `deserialize:"-"`
	// contains filtered or unexported fields
}

func (*Route) Agent added in v0.10.0

func (r *Route) Agent() *agent.AgentConfig

func (*Route) ContainerInfo

func (r *Route) ContainerInfo() *docker.Container

func (*Route) Finalize

func (r *Route) Finalize()

func (*Route) FinalizeHomepageConfig added in v0.10.0

func (r *Route) FinalizeHomepageConfig()

func (*Route) Finish

func (r *Route) Finish(reason any)

func (*Route) HealthCheckConfig

func (r *Route) HealthCheckConfig() *health.HealthCheckConfig

func (*Route) HealthMonitor

func (r *Route) HealthMonitor() health.HealthMonitor

func (*Route) HomepageConfig

func (r *Route) HomepageConfig() *homepage.ItemConfig

func (*Route) HomepageItem added in v0.10.0

func (r *Route) HomepageItem() *homepage.Item

func (*Route) IdlewatcherConfig

func (r *Route) IdlewatcherConfig() *idlewatcher.Config

func (*Route) IsAgent added in v0.10.0

func (r *Route) IsAgent() bool

func (*Route) IsDocker

func (r *Route) IsDocker() bool

func (*Route) IsZeroPort

func (r *Route) IsZeroPort() bool

func (*Route) Key added in v0.11.0

func (r *Route) Key() string

Key implements pool.Object.

func (*Route) LoadBalanceConfig

func (r *Route) LoadBalanceConfig() *loadbalance.Config

func (*Route) Name added in v0.11.0

func (r *Route) Name() string

Name implements pool.Object.

func (*Route) ProviderName

func (r *Route) ProviderName() string

func (*Route) Reference added in v0.11.0

func (r *Route) Reference() string

func (*Route) ShouldExclude

func (r *Route) ShouldExclude() bool

func (*Route) Start

func (r *Route) Start(parent task.Parent) (err gperr.Error)

func (*Route) Started

func (r *Route) Started() bool

func (*Route) TargetURL

func (r *Route) TargetURL() *net.URL

func (*Route) Type

func (r *Route) Type() route.RouteType

func (*Route) UseAccessLog

func (r *Route) UseAccessLog() bool

func (*Route) UseHealthCheck

func (r *Route) UseHealthCheck() bool

func (*Route) UseIdleWatcher

func (r *Route) UseIdleWatcher() bool

func (*Route) UseLoadBalance

func (r *Route) UseLoadBalance() bool

func (*Route) Validate

func (r *Route) Validate() gperr.Error

type Routes

type Routes map[string]*Route

func (Routes) Contains

func (r Routes) Contains(alias string) bool

type Stream

type Stream struct {
	*StreamRoute
	// contains filtered or unexported fields
}

func NewStream

func NewStream(base *StreamRoute) *Stream

func (*Stream) Accept

func (stream *Stream) Accept() (conn types.StreamConn, err error)

func (*Stream) Addr

func (stream *Stream) Addr() net.Addr

func (*Stream) Close

func (stream *Stream) Close() error

func (*Stream) Handle

func (stream *Stream) Handle(conn types.StreamConn) error

func (*Stream) Setup

func (stream *Stream) Setup() error

type StreamRoute

type StreamRoute struct {
	*Route

	net.Stream `json:"-"`

	HealthMon health.HealthMonitor `json:"health"`
	// contains filtered or unexported fields
}

TODO: support stream load balance.

func (*StreamRoute) Finish

func (r *StreamRoute) Finish(reason any)

Finish implements task.TaskFinisher.

func (*StreamRoute) HealthMonitor

func (r *StreamRoute) HealthMonitor() health.HealthMonitor

func (*StreamRoute) Start

func (r *StreamRoute) Start(parent task.Parent) gperr.Error

Start implements task.TaskStarter.

func (*StreamRoute) Task

func (r *StreamRoute) Task() *task.Task

Task implements task.TaskStarter.

type UDPBuf

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

type UDPConn

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

func (*UDPConn) DstAddrString

func (conn *UDPConn) DstAddrString() string

type UDPForwarder

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

func NewUDPForwarder

func NewUDPForwarder(ctx context.Context, forwarder *net.UDPConn, dstAddr net.Addr) *UDPForwarder

func (*UDPForwarder) Accept

func (w *UDPForwarder) Accept() (types.StreamConn, error)

func (*UDPForwarder) Addr

func (w *UDPForwarder) Addr() net.Addr

func (*UDPForwarder) Close

func (w *UDPForwarder) Close() error

func (*UDPForwarder) Handle

func (w *UDPForwarder) Handle(streamConn types.StreamConn) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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