proxy

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROFILE_SPLIT_CHAR = ":"
)

Variables

This section is empty.

Functions

func ProcessKeyName added in v0.0.51

func ProcessKeyName(groupName, modelName string) string

func SanitizeCommand added in v0.0.5

func SanitizeCommand(cmdStr string) ([]string, error)

Types

type Config

type Config struct {
	HealthCheckTimeout int                    `yaml:"healthCheckTimeout"`
	Models             map[string]ModelConfig `yaml:"models"`
	Profiles           map[string][]string    `yaml:"profiles"`
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) FindConfig

func (c *Config) FindConfig(modelName string) (ModelConfig, string, bool)

func (*Config) RealModelName added in v0.0.51

func (c *Config) RealModelName(search string) (string, bool)

type LogMonitor added in v0.0.7

type LogMonitor struct {
	// contains filtered or unexported fields
}

func NewLogMonitor added in v0.0.7

func NewLogMonitor() *LogMonitor

func NewLogMonitorWriter added in v0.0.7

func NewLogMonitorWriter(stdout io.Writer) *LogMonitor

func (*LogMonitor) GetHistory added in v0.0.7

func (w *LogMonitor) GetHistory() []byte

func (*LogMonitor) Subscribe added in v0.0.7

func (w *LogMonitor) Subscribe() chan []byte

func (*LogMonitor) Unsubscribe added in v0.0.7

func (w *LogMonitor) Unsubscribe(ch chan []byte)

func (*LogMonitor) Write added in v0.0.7

func (w *LogMonitor) Write(p []byte) (n int, err error)

type ModelConfig

type ModelConfig struct {
	Cmd           string   `yaml:"cmd"`
	Proxy         string   `yaml:"proxy"`
	Aliases       []string `yaml:"aliases"`
	Env           []string `yaml:"env"`
	CheckEndpoint string   `yaml:"checkEndpoint"`
	UnloadAfter   int      `yaml:"ttl"`
}

func (*ModelConfig) SanitizedCommand added in v0.0.5

func (m *ModelConfig) SanitizedCommand() ([]string, error)

type Process added in v0.0.51

type Process struct {
	sync.Mutex

	ID string
	// contains filtered or unexported fields
}

func NewProcess added in v0.0.51

func NewProcess(ID string, healthCheckTimeout int, config ModelConfig, logMonitor *LogMonitor) *Process

func (*Process) CurrentState added in v0.0.51

func (p *Process) CurrentState() ProcessState

func (*Process) ProxyRequest added in v0.0.51

func (p *Process) ProxyRequest(w http.ResponseWriter, r *http.Request)

func (*Process) Stop added in v0.0.51

func (p *Process) Stop()

type ProcessState added in v0.0.51

type ProcessState string
const (
	StateStopped ProcessState = ProcessState("stopped")
	StateReady   ProcessState = ProcessState("ready")
	StateFailed  ProcessState = ProcessState("failed")
)

type ProxyManager

type ProxyManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(config *Config) *ProxyManager

func (*ProxyManager) HandlerFunc added in v0.0.51

func (pm *ProxyManager) HandlerFunc(w http.ResponseWriter, r *http.Request)

func (*ProxyManager) Run added in v0.0.51

func (pm *ProxyManager) Run(addr ...string) error

func (*ProxyManager) StopProcesses added in v0.0.51

func (pm *ProxyManager) StopProcesses()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL