76 lines
1.5 KiB
Go
76 lines
1.5 KiB
Go
package client
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net"
|
|
"net/http"
|
|
"net/url"
|
|
"time"
|
|
|
|
cuc "git.loafle.net/commons_go/util/context"
|
|
)
|
|
|
|
type SocketHandlers struct {
|
|
URL *url.URL
|
|
RequestCookie http.CookieJar
|
|
RequestHeader http.Header
|
|
SubProtocols []string
|
|
EnableCompression bool
|
|
HandshakeTimeout time.Duration
|
|
TLSConfig *tls.Config
|
|
ReadBufferSize int
|
|
WriteBufferSize int
|
|
}
|
|
|
|
func (sh *SocketHandlers) SocketContext(parent cuc.Context) SocketContext {
|
|
return newSocketContext(parent)
|
|
}
|
|
|
|
func (sh *SocketHandlers) GetURL() *url.URL {
|
|
return sh.URL
|
|
}
|
|
|
|
func (sh *SocketHandlers) GetRequestCookie() http.CookieJar {
|
|
return sh.RequestCookie
|
|
}
|
|
|
|
func (sh *SocketHandlers) GetRequestHeader() http.Header {
|
|
return sh.RequestHeader
|
|
}
|
|
|
|
func (sh *SocketHandlers) GetSubProtocols() []string {
|
|
return sh.SubProtocols
|
|
}
|
|
|
|
func (sh *SocketHandlers) EnableCompression() bool {
|
|
return sh.EnableCompression
|
|
}
|
|
|
|
func (sh *SocketHandlers) UseProxy(req *http.Request) (*url.URL, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (sh *SocketHandlers) GetHandshakeTimeout() time.Duration {
|
|
return sh.HandshakeTimeout
|
|
}
|
|
|
|
func (sh *SocketHandlers) Dial(network, addr string) (net.Conn, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (sh *SocketHandlers) GetTLSConfig() *tls.Config {
|
|
return sh.TLSConfig
|
|
}
|
|
|
|
func (sh *SocketHandlers) GetReadBufferSize() int {
|
|
return sh.ReadBufferSize
|
|
}
|
|
|
|
func (sh *SocketHandlers) GetWriteBufferSize() int {
|
|
return sh.WriteBufferSize
|
|
}
|
|
|
|
func (sh *SocketHandlers) Validate() {
|
|
|
|
}
|