route

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStreamRoute

func NewStreamRoute(base *Route) (route.Route, E.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, E.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) E.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"`
	Idlewatcher *idlewatcher.Config `json:"idlewatcher,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, E.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) E.Error

Start implements task.TaskStarter.

func (*ReveseProxyRoute) String

func (r *ReveseProxyRoute) String() string

func (*ReveseProxyRoute) Task

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

Task implements task.TaskStarter.

type Route

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

	types.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.Item             `json:"homepage,omitempty"`
	AccessLog    *accesslog.Config          `json:"access_log,omitempty"`

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

func (*Route) ContainerInfo

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

func (*Route) Finalize

func (r *Route) Finalize()

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.Item

func (*Route) IdlewatcherConfig

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

func (*Route) IsDocker

func (r *Route) IsDocker() bool

func (*Route) IsZeroPort

func (r *Route) IsZeroPort() bool

func (*Route) LoadBalanceConfig

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

func (*Route) ProviderName

func (r *Route) ProviderName() string

func (*Route) ShouldExclude

func (r *Route) ShouldExclude() bool

func (*Route) Start

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

func (*Route) Started

func (r *Route) Started() bool

func (*Route) TargetName

func (r *Route) TargetName() string

func (*Route) TargetURL

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

func (*Route) Type

func (r *Route) Type() types.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() (err E.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) E.Error

Start implements task.TaskStarter.

func (*StreamRoute) String

func (r *StreamRoute) String() string

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