Documentation ¶
Index ¶
- Variables
- func CreateHandle(onRequest func(conn rony.Conn, reqCtx *gateway.RequestCtx) []byte, ...) gateway.ProxyFactory
- type Config
- type Gateway
- func (g *Gateway) Addr() []string
- func (g *Gateway) GetConn(connID uint64) rony.Conn
- func (g *Gateway) Run()
- func (g *Gateway) SetProxy(method, path string, factory gateway.ProxyFactory)
- func (g *Gateway) Shutdown()
- func (g *Gateway) Start()
- func (g *Gateway) Support(p gateway.Protocol) bool
- func (g *Gateway) TotalConnections() int
- type HttpProxy
- type UnsafeConn
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupportedProtocol = errors.New("gateway protocol is not supported") ErrWriteToClosedConn = errors.New("write to closed conn") ErrConnectionClosed = errors.New("connection closed") ErrUnexpectedSocketRead = errors.New("unexpected socket read") ErrOpCloseReceived = errors.New("close operation received") )
Functions ¶
func CreateHandle ¶ added in v0.6.10
func CreateHandle( onRequest func(conn rony.Conn, reqCtx *gateway.RequestCtx) []byte, onResponse func(data []byte) (*pools.ByteBuffer, map[string]string), ) gateway.ProxyFactory
Types ¶
type Config ¶
type Config struct { Concurrency int ListenAddress string MaxBodySize int MaxIdleTime time.Duration Protocol gateway.Protocol ExternalAddrs []string }
Config holds all the configuration for Gateway
type Gateway ¶
type Gateway struct { gateway.ConnectHandler gateway.MessageHandler gateway.CloseHandler // contains filtered or unexported fields }
Gateway is one of the main components of the Rony framework. Basically Gateway is the component that connects edge.Server with the external world. Clients which are not part of our cluster MUST connect to our edge servers through Gateway. This is an implementation of gateway.Gateway interface with support for **Http** and **Websocket** connections.
func (*Gateway) Run ¶
func (g *Gateway) Run()
Run is blocking and runs the server endless loop until a non-temporary error happens
func (*Gateway) SetProxy ¶ added in v0.6.9
func (g *Gateway) SetProxy(method, path string, factory gateway.ProxyFactory)
SetProxy set http proxy handlers. This function MUST NOT used concurrent and MUST ONLY use it before calling Start or Run.
func (*Gateway) Shutdown ¶
func (g *Gateway) Shutdown()
Shutdown closes the server by stopping services in sequence, in a way that all the flying request will be served before server shutdown.
func (*Gateway) Start ¶
func (g *Gateway) Start()
Start is non-blocking and call the Run function in background