Documentation
¶
Index ¶
- func NewProtoHandler(conf *Server) func(*http.Server, *tls.Conn, http.Handler)
- func SetServerRule(r ServerRule)
- func TLSProxyHandler(s *Server, c net.Conn, b net.Conn, errCh chan error)
- type BalanceHandler
- type FindProductHandler
- type ProxyHandler
- type Rule
- type Server
- type ServerRule
- type ServerTester
- type StreamState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProtoHandler ¶
NewProtoHandler creates a protocol handler for stream.
func SetServerRule ¶
func SetServerRule(r ServerRule)
Types ¶
type BalanceHandler ¶
type BalanceHandler func(c interface{}) (*backend.BfeBackend, error)
BalanceHandler selects backend for current conn.
type FindProductHandler ¶
FindProductHandler gets product by conn vip.
type ProxyHandler ¶
ProxyHandler forwards data between client and backend.
type Rule ¶
type Rule struct {
ProxyProtocol int
}
Rule is the customized config for specific conn in server side.
type Server ¶
type Server struct { // ConnectTimeout optionally specifies the timeout value (ms) to // connect backend. If zero, a default value is used. ConnectTimeout int // ConnectRetryMax optionally specifies the upper limit of connect // retris. If zero, a default value is used ConnectRetryMax int // BalanceHandler optionally specifies the handler for backends balance // BalanceHandler should not be nil. BalanceHandler BalanceHandler // FindProductHandler finds product name for stream proxy FindProductHandler FindProductHandler // ProxyHandler optionally specifies the handler for process client conn // and backend conn. If nil, a default value is used. ProxyHandler ProxyHandler // ProxyConfig optionally specifies the config for ProxyHandler ProxyConfig interface{} }
type ServerRule ¶
type ServerTester ¶
type ServerTester struct {
// contains filtered or unexported fields
}
func NewServerTester ¶
func NewServerTester(t testing.TB, h util.MockHandler, c *Server) *ServerTester
func (*ServerTester) Close ¶
func (st *ServerTester) Close()
func (*ServerTester) Read ¶
func (st *ServerTester) Read(buf []byte) error
client read message until timeout
func (*ServerTester) WantData ¶
func (st *ServerTester) WantData(data []byte)
WantData makes client read and check message
func (*ServerTester) WantError ¶
func (st *ServerTester) WantError(e string)
WantError makes client read and check error
type StreamState ¶
type StreamState struct { StreamErrBalance *metrics.Counter StreamErrConnect *metrics.Counter StreamErrProxy *metrics.Counter StreamErrTransfer *metrics.Counter StreamPanicConn *metrics.Counter StreamBytesRecv *metrics.Counter StreamBytesSent *metrics.Counter }
StreamState is internal state for stream.
func GetStreamState ¶
func GetStreamState() *StreamState
GetStreamState returns internal state for stream.
Click to show internal directories.
Click to hide internal directories.