websocket_fasthttp/client/socket_handler.go

37 lines
746 B
Go
Raw Normal View History

2017-11-29 12:24:48 +00:00
package client
2017-11-29 14:56:36 +00:00
import (
2017-11-30 01:11:53 +00:00
"crypto/tls"
"net"
2017-11-29 14:56:36 +00:00
"net/http"
"net/url"
"time"
cuc "git.loafle.net/commons_go/util/context"
)
2017-11-29 12:24:48 +00:00
type SocketHandler interface {
2017-11-29 14:56:36 +00:00
SocketContext(parent cuc.Context) SocketContext
GetURL() *url.URL
2017-11-30 01:11:53 +00:00
GetRequestCookie() http.CookieJar
2017-11-29 14:56:36 +00:00
GetRequestHeader() http.Header
2017-11-30 01:11:53 +00:00
GetSubProtocols() []string
EnableCompression() bool
UseProxy(req *http.Request) (*url.URL, error)
GetHandshakeTimeout() time.Duration
Dial(network, addr string) (net.Conn, error)
GetTLSConfig() *tls.Config
GetReadBufferSize() int
GetWriteBufferSize() int
2017-11-29 12:24:48 +00:00
// Validate is check handler value
// If you override ths method, must call
//
// func (sh *SocketHandlers) Validate() {
// sh.SocketHandlers.Validate()
// ...
// }
Validate()
}