Documentation
¶
Index ¶
- func BuildGroup(entries []proxylib.Entry) *proxyGroup
- func BypassPool(ctx context.Context) context.Context
- func Error(w http.ResponseWriter, code int, msg string)
- func GroupFromContext(ctx context.Context) *proxyGroup
- func InjectGroup(ctx context.Context, g *proxyGroup) context.Context
- func ParseQuotaCooldown(h http.Header, def time.Duration, now time.Time) time.Duration
- func ParseRetryAfter(v string, def time.Duration) time.Duration
- func WithProxyUse(ctx context.Context) (context.Context, *proxyUse)
- type PoolTransport
- type Proxy
- func (p *Proxy) AudioSpeech(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, ...)
- func (p *Proxy) AudioTranscriptions(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, ...)
- func (p *Proxy) Chat(w http.ResponseWriter, r *http.Request, meta protocol.ChatMetadata, ...)
- func (p *Proxy) Embeddings(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, ...)
- func (p *Proxy) Endpoint(w http.ResponseWriter, r *http.Request, endpoint adapter.Endpoint, ...)
- func (p *Proxy) Error(w http.ResponseWriter, code int, msg string)
- func (p *Proxy) Images(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, ...)
- func (p *Proxy) Moderations(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, ...)
- func (p *Proxy) Responses(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildGroup ¶
BuildGroup compiles entries into an isolated proxy group. The returned group is immutable and safe for concurrent use.
func BypassPool ¶
BypassPool disables proxy routing for the request (webhooks etc.).
func GroupFromContext ¶
GroupFromContext returns the group attached to the context, if any.
func InjectGroup ¶
InjectGroup attaches a proxy group to the context. A nil group leaves the context untouched (global pool / direct fallback apply downstream).
func ParseQuotaCooldown ¶
Types ¶
type PoolTransport ¶
type PoolTransport = poolTransport
PoolTransport is the exported name of the proxy-aware RoundTripper used as the shared client's Transport (kept for tests/introspection).
type Proxy ¶
type Proxy struct {
Client *http.Client
State *resilience.State
Router *router.Router
Snap *config.Snapshot
Policy *policy.Auth
Registry *adapter.Registry
Telemetry telemetry.Recorder
Cache *cache.TTLResponseCache
Quota *quota.Tracked
Plugins *plugin.Registry
ConfigVersion int64
// contains filtered or unexported fields
}
func NewWithClient ¶
func NewWithClient(s *config.Snapshot, st *resilience.State, rt *router.Router, reg *adapter.Registry, client *http.Client) *Proxy
NewWithClient builds a Proxy around a caller-provided shared client. The runtime uses this to keep the SAME client (and its pool transport) across snapshot adoptions — registered adapters hold the client, so replacing it would orphan them and the global pool would never apply.
func NewWithRegistry ¶
func (*Proxy) AudioSpeech ¶
func (p *Proxy) AudioSpeech(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, body []byte)
func (*Proxy) AudioTranscriptions ¶
func (p *Proxy) AudioTranscriptions(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, body []byte)
func (*Proxy) Chat ¶
func (p *Proxy) Chat(w http.ResponseWriter, r *http.Request, meta protocol.ChatMetadata, body []byte)
func (*Proxy) Embeddings ¶
func (p *Proxy) Embeddings(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, body []byte)
func (*Proxy) Endpoint ¶
func (p *Proxy) Endpoint(w http.ResponseWriter, r *http.Request, endpoint adapter.Endpoint, meta protocol.EndpointMetadata, body []byte)
func (*Proxy) Images ¶
func (p *Proxy) Images(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, body []byte)
func (*Proxy) Moderations ¶
func (p *Proxy) Moderations(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, body []byte)
func (*Proxy) Responses ¶
func (p *Proxy) Responses(w http.ResponseWriter, r *http.Request, meta protocol.EndpointMetadata, body []byte)