Documentation
¶
Index ¶
- Constants
- func AddCommand(appConfig *config.AppConfig) *cobra.Command
- func DeleteCommand(appConfig *config.AppConfig) *cobra.Command
- func ImportCommand(appConfig *config.AppConfig) *cobra.Command
- func ListCommand(appConfig *config.AppConfig) *cobra.Command
- func RestartCommand(appConfig *config.AppConfig) *cobra.Command
- func ShellCommand(appConfig *config.AppConfig) *cobra.Command
- func StartCommand(appConfig *config.AppConfig) *cobra.Command
- func StatusCommand(appConfig *config.AppConfig) *cobra.Command
- func StopCommand(appConfig *config.AppConfig) *cobra.Command
- func TokenCommand(appConfig *config.AppConfig) *cobra.Command
- type APIStyle
- type BannerConfig
- type ExportLine
- type ExportMetadata
- type ExportProviderData
- type ExportRuleData
- type ServerManager
- func (sm *ServerManager) Cleanup()
- func (sm *ServerManager) GetGinEngine() *gin.Engine
- func (sm *ServerManager) IsRunning() bool
- func (sm *ServerManager) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (sm *ServerManager) Setup(port int) error
- func (sm *ServerManager) Start() error
- func (sm *ServerManager) Stop() error
- type ServerManagerOption
- func WithAdaptor(enabled bool) ServerManagerOption
- func WithDebug(enabled bool) ServerManagerOption
- func WithExperimentalFeatures(features map[string]bool) ServerManagerOption
- func WithHTTPSCertDir(certDir string) ServerManagerOption
- func WithHTTPSEnabled(enabled bool) ServerManagerOption
- func WithHTTPSRegenerate(regenerate bool) ServerManagerOption
- func WithHost(host string) ServerManagerOption
- func WithOpenBrowser(enabled bool) ServerManagerOption
- func WithRecordDir(dir string) ServerManagerOption
- func WithRecordMode(mode obs.RecordMode) ServerManagerOption
- func WithUI(enabled bool) ServerManagerOption
Constants ¶
const StopTimeout = time.Second
Variables ¶
This section is empty.
Functions ¶
func AddCommand ¶ added in v0.260124.900
AddCommand represents the add provider command
func DeleteCommand ¶ added in v0.260124.900
DeleteCommand represents the delete provider command
func ImportCommand ¶
ImportCommand represents the import rule command
func ListCommand ¶ added in v0.260124.900
ListCommand represents the list providers command
func RestartCommand ¶
RestartCommand represents the restart server command
func ShellCommand ¶ added in v0.260124.900
ShellCommand represents the interactive CLI command
func StartCommand ¶
StartCommand represents the start server command
func StatusCommand ¶
StatusCommand represents the status command
func StopCommand ¶
StopCommand represents the stop server command
Types ¶
type BannerConfig ¶
type BannerConfig struct {
Port int
Host string
EnableUI bool
GlobalConfig *serverconfig.Config
IsDaemon bool
HTTPEnabled bool
}
BannerConfig holds configuration for banner display
type ExportLine ¶
type ExportLine struct {
Type string `json:"type"`
}
ExportLine represents a generic line in the export file
type ExportMetadata ¶
type ExportMetadata struct {
Type string `json:"type"`
Version string `json:"version"`
ExportedAt string `json:"exported_at"`
}
ExportMetadata represents the metadata line
type ExportProviderData ¶
type ExportProviderData struct {
Type string `json:"type"`
UUID string `json:"uuid"`
Name string `json:"name"`
APIBase string `json:"api_base"`
APIStyle string `json:"api_style"`
AuthType string `json:"auth_type"`
Token string `json:"token"`
OAuthDetail *typ.OAuthDetail `json:"oauth_detail"`
Enabled bool `json:"enabled"`
ProxyURL string `json:"proxy_url"`
Timeout int64 `json:"timeout"`
Tags []string `json:"tags"`
Models []string `json:"models"`
}
ExportProviderData represents the provider export data
type ExportRuleData ¶
type ExportRuleData struct {
Type string `json:"type"`
UUID string `json:"uuid"`
Scenario string `json:"scenario"`
RequestModel string `json:"request_model"`
ResponseModel string `json:"response_model"`
Description string `json:"description"`
Services []loadbalance.Service `json:"services"`
LBTactic typ.Tactic `json:"lb_tactic"`
Active bool `json:"active"`
SmartEnabled bool `json:"smart_enabled"`
SmartRouting []interface{} `json:"smart_routing"`
}
ExportRuleData represents the rule export data
type ServerManager ¶
ServerManager manages the HTTP server lifecycle
func NewServerManager ¶
func NewServerManager(appConfig *config.AppConfig, opts ...ServerManagerOption) *ServerManager
NewServerManager creates a new server manager with default options (UI enabled, adapter enabled)
func (*ServerManager) Cleanup ¶
func (sm *ServerManager) Cleanup()
func (*ServerManager) GetGinEngine ¶
func (sm *ServerManager) GetGinEngine() *gin.Engine
func (*ServerManager) IsRunning ¶
func (sm *ServerManager) IsRunning() bool
IsRunning checks if the server is currently running
func (*ServerManager) ServeHTTP ¶
func (sm *ServerManager) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ServerManager) Setup ¶
func (sm *ServerManager) Setup(port int) error
Setup creates and configures the server without starting it
func (*ServerManager) Start ¶
func (sm *ServerManager) Start() error
Start starts the server (requires Setup to be called first)
type ServerManagerOption ¶ added in v0.260124.900
type ServerManagerOption func(*ServerManager)
ServerManagerOption defines a functional option for ServerManager
func WithAdaptor ¶ added in v0.260124.900
func WithAdaptor(enabled bool) ServerManagerOption
WithAdaptor enables or disables the adaptor for the server manager
func WithDebug ¶ added in v0.260124.900
func WithDebug(enabled bool) ServerManagerOption
WithDebug enables or disables the debug mode for the server manager
func WithExperimentalFeatures ¶ added in v0.260124.900
func WithExperimentalFeatures(features map[string]bool) ServerManagerOption
WithExperimentalFeatures sets the experimental features for the server manager
func WithHTTPSCertDir ¶ added in v0.260124.900
func WithHTTPSCertDir(certDir string) ServerManagerOption
WithHTTPSCertDir sets HTTPS certificate directory
func WithHTTPSEnabled ¶ added in v0.260124.900
func WithHTTPSEnabled(enabled bool) ServerManagerOption
WithHTTPSEnabled sets HTTPS enabled flag
func WithHTTPSRegenerate ¶ added in v0.260124.900
func WithHTTPSRegenerate(regenerate bool) ServerManagerOption
WithHTTPSRegenerate sets HTTPS certificate regenerate flag
func WithHost ¶ added in v0.260124.900
func WithHost(host string) ServerManagerOption
func WithOpenBrowser ¶ added in v0.260124.900
func WithOpenBrowser(enabled bool) ServerManagerOption
WithOpenBrowser enables or disables automatic browser opening
func WithRecordDir ¶ added in v0.260124.900
func WithRecordDir(dir string) ServerManagerOption
WithRecordDir sets the record directory for request/response recording
func WithRecordMode ¶ added in v0.260124.900
func WithRecordMode(mode obs.RecordMode) ServerManagerOption
WithRecordMode sets the record mode for request/response recording mode: empty string = disabled, "all" = record all, "response" = response only
func WithUI ¶ added in v0.260124.900
func WithUI(enabled bool) ServerManagerOption
WithUI enables or disables the UI for the server manager