Documentation
¶
Index ¶
- type APIServer
- func New(cfg config.Config, store *proxy.Store, intercept *proxy.InterceptQueue, ...) *APIServer
- func NewListenerMode(cfg config.Config, cbStore *callback.Store, xssStore *xsshunter.Store, ...) *APIServer
- func NewTeamServerMode(cfg config.Config, cbStore *callback.Store, xssStore *xsshunter.Store, ...) *APIServer
- type BuildInfo
- type Hub
- func (h *Hub) ActiveUsers() []string
- func (h *Hub) Broadcast() chan<- any
- func (h *Hub) HasNickname(nickname string) bool
- func (h *Hub) Rename(oldNick, newNick string) (bool, error)
- func (h *Hub) Run()
- func (h *Hub) ServeWS(w http.ResponseWriter, r *http.Request)
- func (h *Hub) SetOnConnect(fn OnConnectFunc)
- type ListenerRelay
- type OnConnectFunc
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIServer ¶
type APIServer struct {
// contains filtered or unexported fields
}
APIServer serves the REST API and the embedded frontend.
func New ¶
func New( cfg config.Config, store *proxy.Store, intercept *proxy.InterceptQueue, scope *proxy.Scope, noise *proxy.NoiseFilter, replace *proxy.MatchReplace, customData *proxy.CustomData, transport *proxy.TransportConfig, wsStore *proxy.WSStore, ca *cert.CA, hub *Hub, noteStore *notes.Store, pluginManager *plugins.Manager, buildInfo BuildInfo, cancelFunc context.CancelFunc, ) *APIServer
New creates an APIServer.
func NewListenerMode ¶
func NewListenerMode(cfg config.Config, cbStore *callback.Store, xssStore *xsshunter.Store, hub *Hub, token string) *APIServer
NewListenerMode creates an APIServer in listener mode (no proxy components).
func NewTeamServerMode ¶
func NewTeamServerMode(cfg config.Config, cbStore *callback.Store, xssStore *xsshunter.Store, hub *Hub, teamStore *team.Store, token string) *APIServer
NewTeamServerMode creates an APIServer in team server mode (listener + team features, no frontend).
func (*APIServer) RestartRequested ¶
RestartRequested returns true if the server was shut down for a restart (e.g. after update).
type BuildInfo ¶
type BuildInfo struct {
Version string `json:"version"`
Commit string `json:"commit"`
UpdateAvailable bool `json:"updateAvailable"`
LatestVersion string `json:"latestVersion"`
}
BuildInfo holds version information embedded at build time.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub manages WebSocket clients and broadcasts events to all of them.
func NewHub ¶
func NewHub() *Hub
NewHub creates a Hub. Call Run() in a goroutine before accepting connections.
func (*Hub) ActiveUsers ¶
ActiveUsers returns a deduplicated list of connected nicknames (non-empty only).
func (*Hub) HasNickname ¶
HasNickname returns true if a client with the given nickname is already connected.
func (*Hub) Rename ¶
Rename swaps oldNick → newNick on an existing conn and emits team.nickname_changed. Returns (false, nil) if oldNick has no conn.
func (*Hub) Run ¶
func (h *Hub) Run()
Run reads from the broadcast channel and fans out to all connected clients. It blocks until the channel is closed.
func (*Hub) ServeWS ¶
func (h *Hub) ServeWS(w http.ResponseWriter, r *http.Request)
ServeWS upgrades the HTTP connection to WebSocket and registers the client.
func (*Hub) SetOnConnect ¶
func (h *Hub) SetOnConnect(fn OnConnectFunc)
SetOnConnect sets a callback invoked when a named user connects.
type ListenerRelay ¶
type ListenerRelay struct {
// contains filtered or unexported fields
}
ListenerRelay maintains a WebSocket connection to the remote teamserver and relays team.* events to the local Hub.
func NewListenerRelay ¶
func NewListenerRelay(hub *Hub) *ListenerRelay
NewListenerRelay creates a relay. Call Update() to start connecting.
func (*ListenerRelay) SetNickname ¶
func (lr *ListenerRelay) SetNickname(newNickname string)
SetNickname updates the cached nickname for the next reconnect, without closing the current connection.
func (*ListenerRelay) Update ¶
func (lr *ListenerRelay) Update(listenerURL, token, nickname string)
Update sets the connection parameters and (re)starts the relay. Pass empty url or token to stop the relay.
type OnConnectFunc ¶
type OnConnectFunc func(nickname, ip string)
OnConnectFunc is called when a named user connects with their nickname and IP.
type Settings ¶
type Settings struct {
ProxyPort int `json:"proxyPort"`
UIPort int `json:"uiPort"`
InterceptEnabled bool `json:"interceptEnabled"`
InterceptTimeout int `json:"interceptTimeout"` // seconds
ListenerURL string `json:"listenerUrl"`
HTTP2Enabled bool `json:"http2Enabled"`
KeepAliveEnabled bool `json:"keepAliveEnabled"`
SOCKSHost string `json:"socksHost"`
SOCKSPort int `json:"socksPort"`
SOCKSUsername string `json:"socksUsername"`
SOCKSPassword string `json:"socksPassword"`
SOCKSDNS bool `json:"socksDns"`
TeamToken string `json:"teamToken"`
TeamNickname string `json:"teamNickname"`
MaxRequests int `json:"maxRequests"`
DisableUpdateChecks bool `json:"disableUpdateChecks"`
}
Settings holds runtime-adjustable configuration exposed via the API.
Source Files
¶
- handlers_callbacks.go
- handlers_certs.go
- handlers_configs.go
- handlers_customdata.go
- handlers_execute.go
- handlers_fuzzer.go
- handlers_generate.go
- handlers_highlights.go
- handlers_interact_plugins.go
- handlers_intercept.go
- handlers_manipulate.go
- handlers_manipulate_ws.go
- handlers_noise.go
- handlers_notes.go
- handlers_plugins.go
- handlers_replace.go
- handlers_requests.go
- handlers_scope.go
- handlers_settings.go
- handlers_sitemap.go
- handlers_sliver.go
- handlers_system.go
- handlers_team.go
- handlers_theme.go
- handlers_ws.go
- handlers_xsshunter.go
- routes.go
- server.go
- ws.go
- ws_relay.go