Documentation
¶
Index ¶
- type AIListenerRequest
- type AIProviderRequest
- type AIProviderTestResult
- type ActiveListener
- type ActiveMulticast
- type Config
- type ConversationMessage
- type DashboardConfig
- type EnhancedListener
- type IPRateLimitConfig
- type ListenerManager
- func (lm *ListenerManager) GetActiveListener(listenerID string) (*ActiveListener, bool)
- func (lm *ListenerManager) ListActiveListeners() []*ActiveListener
- func (lm *ListenerManager) StartListener(config *database.Listener, tapFactory tunnel.TapFactory) error
- func (lm *ListenerManager) StopListener(listenerID string) error
- func (lm *ListenerManager) UpdateTLSConfig(tlsConfig *tls.Config)
- type LogEntry
- type LogFileContentResponse
- type LogFileInfo
- type LogFilesResponse
- type LogManager
- type LogWriter
- type LoginBackoffConfig
- type LogsResponse
- type MulticastManager
- func (m *MulticastManager) AddSubscriber(port int, sub *subscriber) error
- func (m *MulticastManager) RemoveSubscriber(port int, subID string)
- func (m *MulticastManager) StartMulticast(cfg *database.MulticastTunnel) error
- func (m *MulticastManager) StopMulticast(id string) error
- func (m *MulticastManager) UpdateTLSConfig(tlsConf *tls.Config)
- type OpenAIMessage
- type OpenAIRequest
- type OpenAIResponse
- type SSOConfigRequest
- type SSOConfigResponse
- type SecurityConfig
- type SecurityEvent
- type Server
- func (s *Server) AddUser(user, pass string, addrs ...string) error
- func (s *Server) BasicAuthMiddleware(next http.HandlerFunc) http.HandlerFunc
- func (s *Server) Close() error
- func (s *Server) CombinedAuthMiddleware(next http.HandlerFunc) http.HandlerFunc
- func (s *Server) Debugf(f string, args ...interface{})
- func (s *Server) DeleteUser(user string)
- func (s *Server) Errorf(f string, args ...interface{}) error
- func (s *Server) GetFingerprint() string
- func (s *Server) HTTPHandler() http.Handler
- func (s *Server) HandleDeleteUser(w http.ResponseWriter, r *http.Request)
- func (s *Server) Infof(f string, args ...interface{})
- func (s *Server) ResetUsers(users []*settings.User)
- func (s *Server) Run(host, port string) error
- func (s *Server) Shutdown() error
- func (s *Server) Start(host, port string) error
- func (s *Server) StartContext(ctx context.Context, host, port string) error
- func (s *Server) UserAuthMiddleware(next http.HandlerFunc) http.HandlerFunc
- func (s *Server) Wait() error
- type TLSConfig
- type UpdateUserRequest
- type UserInfo
- type UserToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIListenerRequest ¶
type AIListenerRequest struct {
Name string `json:"name"`
Port int `json:"port"`
Mode string `json:"mode"`
AIProviderID string `json:"ai_provider_id"`
OpenAPISpec string `json:"openapi_spec"`
SystemPrompt string `json:"system_prompt"`
UseTLS bool `json:"use_tls"`
}
AIListenerRequest represents the request payload for creating AI listeners
type AIProviderRequest ¶
type AIProviderRequest struct {
Name string `json:"name"`
ProviderType string `json:"provider_type"`
APIKey string `json:"api_key"`
APIEndpoint string `json:"api_endpoint"`
Model string `json:"model"`
MaxTokens int `json:"max_tokens"`
Temperature float64 `json:"temperature"`
Enabled bool `json:"enabled"`
}
AIProviderRequest represents the request payload for creating/updating AI providers
func DefaultAIProviderConfig ¶
func DefaultAIProviderConfig(providerType string) AIProviderRequest
DefaultAIProviderConfig returns default configuration for different providers
type AIProviderTestResult ¶
type AIProviderTestResult struct {
Status string `json:"status"` // "success" or "failed"
Message string `json:"message"`
}
AIProviderTestResult represents the result of testing an AI provider
type ActiveListener ¶
type ActiveListener struct {
ID string
Config *database.Listener
Server *http.Server
Cancel context.CancelFunc
TapFactory tunnel.TapFactory
}
ActiveListener represents a running HTTP listener
type ActiveMulticast ¶
type ActiveMulticast struct {
ID string
Config *database.MulticastTunnel
Server *http.Server
Cancel context.CancelFunc
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
KeySeed string
KeyFile string
AuthFile string
Auth string
Proxy string
Reverse bool
KeepAlive time.Duration
TLS TLSConfig
TlsConf *tls.Config
Database *database.DatabaseConfig
Auth0 *auth.Auth0Config
Dashboard DashboardConfig
LogDir string
// Security-related server settings
Security SecurityConfig
}
Config is the configuration for the chisel service
type ConversationMessage ¶
type ConversationMessage struct {
Role string `json:"role"` // "user", "assistant", "system"
Content string `json:"content"`
Timestamp time.Time `json:"timestamp"`
}
ConversationMessage represents a message in the AI conversation
type DashboardConfig ¶
DashboardConfig holds dashboard configuration
type EnhancedListener ¶
type EnhancedListener struct {
*database.Listener
Active bool `json:"active"` // Computed from Status field
AIGenerationStatus string `json:"ai_generation_status,omitempty"`
AIProviderName string `json:"ai_provider_name,omitempty"`
AIProviderType string `json:"ai_provider_type,omitempty"`
AIGenerationError string `json:"ai_generation_error,omitempty"`
}
EnhancedListener represents a listener with AI information
type IPRateLimitConfig ¶
type IPRateLimitConfig struct {
MaxPerMinute int `json:"max_per_minute"`
BanMinutes int `json:"ban_minutes"`
}
IPRateLimitConfig controls IP-level request caps independent of username
type ListenerManager ¶
type ListenerManager struct {
// contains filtered or unexported fields
}
ListenerManager manages HTTP listeners/proxies
func NewListenerManager ¶
func NewListenerManager(captureService *capture.Service, db database.Database, tlsConfig *tls.Config) *ListenerManager
NewListenerManager creates a new listener manager
func (*ListenerManager) GetActiveListener ¶
func (lm *ListenerManager) GetActiveListener(listenerID string) (*ActiveListener, bool)
GetActiveListener returns an active listener by ID
func (*ListenerManager) ListActiveListeners ¶
func (lm *ListenerManager) ListActiveListeners() []*ActiveListener
ListActiveListeners returns all active listeners
func (*ListenerManager) StartListener ¶
func (lm *ListenerManager) StartListener(config *database.Listener, tapFactory tunnel.TapFactory) error
StartListener starts a new HTTP listener
func (*ListenerManager) StopListener ¶
func (lm *ListenerManager) StopListener(listenerID string) error
StopListener stops a running listener
func (*ListenerManager) UpdateTLSConfig ¶
func (lm *ListenerManager) UpdateTLSConfig(tlsConfig *tls.Config)
UpdateTLSConfig updates the TLS configuration for the listener manager
type LogEntry ¶
type LogEntry struct {
Timestamp time.Time `json:"timestamp"`
Level string `json:"level"`
Message string `json:"message"`
Source string `json:"source,omitempty"`
}
LogEntry represents a single log entry
type LogFileContentResponse ¶
type LogFileContentResponse struct {
Filename string `json:"filename"`
Lines []string `json:"lines"`
Total int `json:"total"`
}
LogFileContentResponse represents the response for log file content
type LogFileInfo ¶
type LogFileInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
ModifiedTime string `json:"modified_time"`
}
LogFileInfo represents information about a log file
type LogFilesResponse ¶
type LogFilesResponse struct {
Files []LogFileInfo `json:"files"`
}
LogFilesResponse represents the response for log files API
type LogManager ¶
type LogManager struct {
// contains filtered or unexported fields
}
LogManager handles log storage and retrieval
func NewLogManager ¶
func NewLogManager(logDir string) (*LogManager, error)
NewLogManager creates a new log manager
func (*LogManager) GetLogFiles ¶
func (lm *LogManager) GetLogFiles() ([]string, error)
GetLogFiles returns available log files
func (*LogManager) GetRecentLogs ¶
func (lm *LogManager) GetRecentLogs(limit int) []LogEntry
GetRecentLogs returns recent log entries
func (*LogManager) ReadLogFile ¶
func (lm *LogManager) ReadLogFile(filename string, lines int) ([]string, error)
ReadLogFile reads a specific log file
func (*LogManager) WriteLog ¶
func (lm *LogManager) WriteLog(level, message, source string)
WriteLog writes a log entry to file and memory
type LogWriter ¶
type LogWriter struct {
// contains filtered or unexported fields
}
LogWriter implements io.Writer interface for integration with standard loggers
func NewLogWriter ¶
func NewLogWriter(logManager *LogManager, level, source string) *LogWriter
NewLogWriter creates a new log writer
type LoginBackoffConfig ¶
type LoginBackoffConfig struct {
BaseDelayMS int `json:"base_delay_ms"`
MaxDelayMS int `json:"max_delay_ms"`
MaxExponent int `json:"max_exponent"`
HardLockFailures int `json:"hard_lock_failures"`
HardLockMinutes int `json:"hard_lock_minutes"`
PerIPEnabled bool `json:"per_ip_enabled"`
}
LoginBackoffConfig controls login rate limiting/backoff behavior Durations are expressed as milliseconds/minutes for easy JSON handling.
type LogsResponse ¶
type LogsResponse struct {
Logs []LogEntry `json:"logs"`
TotalCount int `json:"total_count"`
HasMore bool `json:"has_more"`
}
LogsResponse represents the response for logs API
type MulticastManager ¶
type MulticastManager struct {
// contains filtered or unexported fields
}
MulticastManager manages persistent HTTPS endpoints that broadcast inbound requests to all subscribers via capture SSE.
func NewMulticastManager ¶
func (*MulticastManager) AddSubscriber ¶
func (m *MulticastManager) AddSubscriber(port int, sub *subscriber) error
func (*MulticastManager) RemoveSubscriber ¶
func (m *MulticastManager) RemoveSubscriber(port int, subID string)
func (*MulticastManager) StartMulticast ¶
func (m *MulticastManager) StartMulticast(cfg *database.MulticastTunnel) error
StartMulticast starts an HTTPS server for the given config (webhook mode only in phase 1)
func (*MulticastManager) StopMulticast ¶
func (m *MulticastManager) StopMulticast(id string) error
func (*MulticastManager) UpdateTLSConfig ¶
func (m *MulticastManager) UpdateTLSConfig(tlsConf *tls.Config)
type OpenAIMessage ¶
OpenAIMessage represents a message in the OpenAI conversation
type OpenAIRequest ¶
type OpenAIRequest struct {
Model string `json:"model"`
Messages []OpenAIMessage `json:"messages"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
}
OpenAIRequest represents the request structure for OpenAI API
type OpenAIResponse ¶
type OpenAIResponse struct {
Choices []struct {
Message struct {
Content string `json:"content"`
} `json:"message"`
} `json:"choices"`
Error *struct {
Message string `json:"message"`
Type string `json:"type"`
} `json:"error,omitempty"`
}
OpenAIResponse represents the response from OpenAI API
type SSOConfigRequest ¶
type SSOConfigRequest struct {
Provider database.SSOProvider `json:"provider"`
Enabled bool `json:"enabled"`
Config json.RawMessage `json:"config"`
}
SSOConfigRequest represents SSO configuration request
type SSOConfigResponse ¶
SSOConfigResponse represents SSO configuration response
type SecurityConfig ¶
type SecurityConfig struct {
LoginBackoff LoginBackoffConfig `json:"login_backoff"`
IPRate IPRateLimitConfig `json:"ip_rate"`
SessionTTLMinutes int `json:"session_ttl_minutes"`
}
SecurityConfig groups security-related settings
type SecurityEvent ¶
type SecurityEvent struct {
Type string `json:"type"`
Severity string `json:"severity"`
Username string `json:"username"`
IP string `json:"ip"`
At time.Time `json:"at"`
Message string `json:"message"`
}
SecurityEvent captures notable security actions
type Server ¶
Server respresent a chisel service
func (*Server) BasicAuthMiddleware ¶
func (s *Server) BasicAuthMiddleware(next http.HandlerFunc) http.HandlerFunc
BasicAuthMiddleware is an exported version of basicAuthMiddleware for testing
func (*Server) CombinedAuthMiddleware ¶
func (s *Server) CombinedAuthMiddleware(next http.HandlerFunc) http.HandlerFunc
CombinedAuthMiddleware is an exported version of combinedAuthMiddleware for testing
func (*Server) DeleteUser ¶
DeleteUser removes a user from the server user index
func (*Server) GetFingerprint ¶
GetFingerprint is used to access the server fingerprint
func (*Server) HTTPHandler ¶
HTTPHandler exposes the main HTTP handler for testing
func (*Server) HandleDeleteUser ¶
func (s *Server) HandleDeleteUser(w http.ResponseWriter, r *http.Request)
HandleDeleteUser is an exported version of handleDeleteUser for testing
func (*Server) ResetUsers ¶
ResetUsers in the server user index. Use nil to remove all.
func (*Server) Run ¶
Run is responsible for starting the chisel service. Internally this calls Start then Wait.
func (*Server) StartContext ¶
StartContext is responsible for kicking off the http server, and can be closed by cancelling the provided context
func (*Server) UserAuthMiddleware ¶
func (s *Server) UserAuthMiddleware(next http.HandlerFunc) http.HandlerFunc
UserAuthMiddleware is an exported version of userAuthMiddleware for testing
type UpdateUserRequest ¶
type UserInfo ¶
type UserInfo struct {
Username string `json:"username"`
Email string `json:"email,omitempty"`
DisplayName string `json:"display_name,omitempty"`
IsAdmin bool `json:"admin"`
SSOEnabled bool `json:"sso_enabled"`
CanEditProfile bool `json:"can_edit_profile"`
AuthMethod string `json:"auth_method,omitempty"`
}
UserInfo represents user information for the frontend
type UserToken ¶
type UserToken struct {
ID string `json:"id"`
Name string `json:"name"`
Token string `json:"token,omitempty"` // Only included when creating
CreatedAt time.Time `json:"created_at"`
LastUsed *time.Time `json:"last_used,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
UserToken represents an API token
Source Files
¶
- assets_embed.go
- listener_manager.go
- log_manager.go
- multicast_manager.go
- server.go
- server_api.go
- server_api_ai.go
- server_api_listeners.go
- server_api_logs.go
- server_api_multicast.go
- server_api_port_reservations.go
- server_api_security.go
- server_api_sso.go
- server_api_user.go
- server_dashboard.go
- server_handler.go
- server_listen.go
- server_rest.go