Documentation
¶
Index ¶
- Variables
- type Manager
- func (m *Manager) CloseSession(sessionID string) error
- func (m *Manager) CreateSession(config *protocol.SessionConfig) (string, error)
- func (m *Manager) GetSession(sessionID string) (*Session, error)
- func (m *Manager) ListSessions() []SessionStats
- func (m *Manager) SessionCount() int
- func (m *Manager) SetMaxSessions(max int)
- func (m *Manager) SetSessionTimeout(timeout time.Duration)
- func (m *Manager) Shutdown()
- type Session
- func (s *Session) ClearCache()
- func (s *Session) ClearCookies()
- func (s *Session) Close()
- func (s *Session) Get(ctx context.Context, url string, headers map[string][]string) (*transport.Response, error)
- func (s *Session) GetCookies() map[string]string
- func (s *Session) GetStream(ctx context.Context, url string, headers map[string][]string) (*StreamResponse, error)
- func (s *Session) GetTransport() *transport.Transport
- func (s *Session) IdleTime() time.Duration
- func (s *Session) IsActive() bool
- func (s *Session) Post(ctx context.Context, url string, body []byte, headers map[string][]string) (*transport.Response, error)
- func (s *Session) PostStream(ctx context.Context, url string, body []byte, headers map[string][]string) (*StreamResponse, error)
- func (s *Session) Request(ctx context.Context, req *transport.Request) (*transport.Response, error)
- func (s *Session) RequestStream(ctx context.Context, req *transport.Request) (*StreamResponse, error)
- func (s *Session) SetCookie(name, value string)
- func (s *Session) SetCookies(cookies map[string]string)
- func (s *Session) Stats() SessionStats
- func (s *Session) Touch()
- type SessionStats
- type StreamResponse
Constants ¶
This section is empty.
Variables ¶
var (
ErrSessionClosed = errors.New("session is closed")
)
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages all active sessions
func (*Manager) CloseSession ¶
CloseSession closes and removes a session
func (*Manager) CreateSession ¶
func (m *Manager) CreateSession(config *protocol.SessionConfig) (string, error)
CreateSession creates a new session and returns its ID
func (*Manager) GetSession ¶
GetSession retrieves a session by ID
func (*Manager) ListSessions ¶
func (m *Manager) ListSessions() []SessionStats
ListSessions returns stats for all active sessions
func (*Manager) SessionCount ¶
SessionCount returns the number of active sessions
func (*Manager) SetMaxSessions ¶
SetMaxSessions sets the maximum number of concurrent sessions
func (*Manager) SetSessionTimeout ¶
SetSessionTimeout sets the session idle timeout
type Session ¶
type Session struct {
ID string
CreatedAt time.Time
LastUsed time.Time
RequestCount int64
Config *protocol.SessionConfig
// contains filtered or unexported fields
}
Session represents a persistent HTTP session with connection affinity
func NewSession ¶
func NewSession(id string, config *protocol.SessionConfig) *Session
NewSession creates a new session with its own connection pool
func (*Session) ClearCache ¶
func (s *Session) ClearCache()
ClearCache clears all cached URLs (removes If-None-Match/If-Modified-Since headers)
func (*Session) ClearCookies ¶
func (s *Session) ClearCookies()
ClearCookies removes all cookies from this session
func (*Session) Close ¶
func (s *Session) Close()
Close marks the session as inactive and closes connections
func (*Session) Get ¶
func (s *Session) Get(ctx context.Context, url string, headers map[string][]string) (*transport.Response, error)
Get performs a GET request
func (*Session) GetCookies ¶
GetCookies returns all cookies for this session
func (*Session) GetStream ¶ added in v1.5.3
func (s *Session) GetStream(ctx context.Context, url string, headers map[string][]string) (*StreamResponse, error)
GetStream performs a streaming GET request
func (*Session) GetTransport ¶
GetTransport returns the session's transport
func (*Session) Post ¶
func (s *Session) Post(ctx context.Context, url string, body []byte, headers map[string][]string) (*transport.Response, error)
Post performs a POST request
func (*Session) PostStream ¶ added in v1.5.3
func (s *Session) PostStream(ctx context.Context, url string, body []byte, headers map[string][]string) (*StreamResponse, error)
PostStream performs a streaming POST request
func (*Session) RequestStream ¶ added in v1.5.3
func (s *Session) RequestStream(ctx context.Context, req *transport.Request) (*StreamResponse, error)
RequestStream executes an HTTP request and returns a streaming response The caller is responsible for closing the response when done Note: Streaming does NOT support redirects - use Request() for redirect handling
func (*Session) SetCookies ¶
SetCookies sets multiple cookies for this session
type SessionStats ¶
type SessionStats struct {
ID string
Preset string
CreatedAt time.Time
LastUsed time.Time
RequestCount int64
Active bool
CookieCount int
CacheEntryCount int // Number of cached URLs (for If-None-Match/If-Modified-Since)
Age time.Duration
IdleTime time.Duration
TransportStats map[string]interface{}
}
SessionStats contains session statistics
type StreamResponse ¶ added in v1.5.3
type StreamResponse = transport.StreamResponse
StreamResponse wraps transport.StreamResponse for session-level streaming