Documentation
¶
Index ¶
Constants ¶
const ( StreamConnectionType = ConnectionType("stream") PacketConnectionType = ConnectionType("packet") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionHandler ¶
type ConnectionHandler struct { // Name of the connection handler. This is used to reference the handler // within the Outline app configuration. Name string `json:"name,omitempty"` // WrappedHandlerRaw is the raw JSON configuration for the wrapped // layer4.NextHandler. It is unmarshalled and used to create the actual // handler instance. WrappedHandlerRaw json.RawMessage `json:"handle,omitempty" caddy:"namespace=layer4.handlers inline_key=handler"` // contains filtered or unexported fields }
ConnectionHandler represents a named, reusable connection handler.
These handlers are configured within the Outline app and can be shared across different applications. A ConnectionHandler compiles and wraps a layer4 handler, allowing it to be referenced and reused by name. This enables sharing configurations and services between different protocol stacks.
For example, you might have a Shadowsocks handler (TCP or UDP) in the layer4 app and a Shadowsocks-over-WebSockets handler in the HTTP app. Using ConnectionHandler, you can wrap a single Shadowsocks handler and reference it by name in both the layer4 and HTTP app configurations, ensuring they share the same Shadowsocks service configuration.
func (*ConnectionHandler) Handle ¶
func (ch *ConnectionHandler) Handle(cx *layer4.Connection, next layer4.Handler) error
func (*ConnectionHandler) Provision ¶
func (ch *ConnectionHandler) Provision(ctx caddy.Context) error
Provision sets up the connection handler.
type ConnectionHandlers ¶
type ConnectionHandlers []*ConnectionHandler
func (ConnectionHandlers) Provision ¶
func (ch ConnectionHandlers) Provision(ctx caddy.Context) error
Provision sets up all the connection handlers.
type ConnectionType ¶
type ConnectionType string
type ModuleRegistration ¶
type ModuleRegistration caddy.ModuleInfo
func (ModuleRegistration) CaddyModule ¶
func (m ModuleRegistration) CaddyModule() caddy.ModuleInfo
CaddyModule implements the caddy.Module interface
type OutlineApp ¶
type OutlineApp struct { ShadowsocksConfig *ShadowsocksConfig `json:"shadowsocks,omitempty"` Handlers ConnectionHandlers `json:"connection_handlers,omitempty"` // contains filtered or unexported fields }
func (OutlineApp) CaddyModule ¶
func (OutlineApp) CaddyModule() caddy.ModuleInfo
func (*OutlineApp) Provision ¶
func (app *OutlineApp) Provision(ctx caddy.Context) error
Provision sets up Outline.
type OutlineHandler ¶
type OutlineHandler struct { // ConnectionHandler specifies the name of the connection handler to use. // This name must match a handler configured within the Outline app. ConnectionHandler string `json:"connection_handler,omitempty"` // contains filtered or unexported fields }
OutlineHandler implements a Caddy layer4 plugin for handling Outline connections.
It acts as a bridge between the Caddy layer4 framework and the Outline app's configured connection handlers. It selects the appropriate handler based on the `connection_handler` configuration and the connection type (stream or packet). This allows different processing logic to be applied depending on the underlying protocol.
func (*OutlineHandler) CaddyModule ¶
func (*OutlineHandler) CaddyModule() caddy.ModuleInfo
func (*OutlineHandler) Handle ¶
func (h *OutlineHandler) Handle(cx *layer4.Connection, next layer4.Handler) error
Handle implements layer4.NextHandler.
func (*OutlineHandler) Provision ¶
func (h *OutlineHandler) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (*OutlineHandler) Validate ¶
func (h *OutlineHandler) Validate() error
Validate implements caddy.Validator.
type ShadowsocksConfig ¶
type ShadowsocksConfig struct {
ReplayHistory int `json:"replay_history,omitempty"`
}
type ShadowsocksHandler ¶
type ShadowsocksHandler struct { Keys []KeyConfig `json:"keys,omitempty"` // contains filtered or unexported fields }
ShadowsocksHandler implements a Caddy plugin for handling Outline Shadowsocks connections.
It manages Shadowsocks encryption keys, creates the necessary outline.StreamHandler or outline.AssociationHandler, and dispatches connections to the appropriate handler based on the connection type (stream or packet).
func (*ShadowsocksHandler) CaddyModule ¶
func (*ShadowsocksHandler) CaddyModule() caddy.ModuleInfo
func (*ShadowsocksHandler) Handle ¶
func (h *ShadowsocksHandler) Handle(cx *layer4.Connection, _ layer4.Handler) error
Handle implements layer4.NextHandler.
func (*ShadowsocksHandler) Provision ¶
func (h *ShadowsocksHandler) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
type WebSocketHandler ¶
type WebSocketHandler struct { // Type specifies the type of connection being proxied (stream or packet). If // not provided, it defaults to StreamConnectionType. Type ConnectionType `json:"type,omitempty"` // ConnectionHandler specifies the name of the connection handler to use. This // name must match a handler configured within the Outline app. ConnectionHandler string `json:"connection_handler,omitempty"` // contains filtered or unexported fields }
WebSocketHandler implements a Caddy HTTP middleware handler that proxies WebSocket connections for Outline.
It upgrades HTTP WebSocket requests to a raw connection that can be handled by an Outline connection handler. This allows using Outline's connection handling logic over WebSockets.
func (*WebSocketHandler) CaddyModule ¶
func (*WebSocketHandler) CaddyModule() caddy.ModuleInfo
func (*WebSocketHandler) Provision ¶
func (h *WebSocketHandler) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (WebSocketHandler) ServeHTTP ¶
func (h WebSocketHandler) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error
ServeHTTP implements caddyhttp.MiddlewareHandler.
func (*WebSocketHandler) Validate ¶
func (h *WebSocketHandler) Validate() error
Validate implements caddy.Validator.