tcpGateway

package
v0.12.50 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2021 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

This section is empty.

Types

type Config

type Config struct {
	Concurrency   int
	ListenAddress string
	MaxBodySize   int
	MaxIdleTime   time.Duration
	Protocol      rony.GatewayProtocol
	ExternalAddrs []string
	Logger        log.Logger
	// CORS
	AllowedHeaders []string // Default Allow All
	AllowedOrigins []string // Default Allow All
	AllowedMethods []string // Default Allow All
}

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 MustNew

func MustNew(config Config) *Gateway

func New

func New(config Config) (*Gateway, error)

func (*Gateway) Addr

func (g *Gateway) Addr() []string

Addr return the address which gateway is listen on

func (*Gateway) GetConn

func (g *Gateway) GetConn(connID uint64) rony.Conn

GetConn returns the connection identified by connID

func (*Gateway) Protocol added in v0.7.2

func (g *Gateway) Protocol() rony.GatewayProtocol

func (*Gateway) Run

func (g *Gateway) Run()

Run is blocking and runs the server endless loop until a non-temporary error happens

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

func (*Gateway) Support added in v0.6.40

func (g *Gateway) Support(p rony.GatewayProtocol) bool

func (*Gateway) TotalConnections

func (g *Gateway) TotalConnections() int

type UnsafeConn

type UnsafeConn interface {
	net.Conn
	UnsafeConn() net.Conn
}

Directories

Path Synopsis
Package wsutil provides utilities for working with WebSocket protocol.
Package wsutil provides utilities for working with WebSocket protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL