core

package
v0.0.0-...-0fae6ba Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Target
	Priority int          `json:"priority"`
	Weight   int          `json:"weight"`
	Sni      string       `json:"sni,omitempty"`
	Stats    BackendStats `json:"stats"`
}

*

  • Backend means upstream server
  • with all needed associate information

func (*Backend) Address

func (this *Backend) Address() string

*

  • Get backends target address

func (*Backend) EqualTo

func (this *Backend) EqualTo(other Backend) bool

*

  • Check if backend equal to another

func (*Backend) MergeFrom

func (this *Backend) MergeFrom(other Backend) *Backend

*

  • Merge another backend to this one

func (Backend) String

func (this Backend) String() string

*

  • String conversion

type BackendStats

type BackendStats struct {
	Live               bool   `json:"live"`
	Discovered         bool   `json:"discovered"`
	TotalConnections   int64  `json:"total_connections"`
	ActiveConnections  uint   `json:"active_connections"`
	RefusedConnections uint64 `json:"refused_connections"`
	RxBytes            uint64 `json:"rx"`
	TxBytes            uint64 `json:"tx"`
	RxSecond           uint   `json:"rx_second"`
	TxSecond           uint   `json:"tx_second"`
}

*

  • Backend status

type Balancer

type Balancer interface {
	/**
	 * Elect backend based on Balancer implementation
	 */
	Elect(Context, []*Backend) (*Backend, error)
}

*

  • Balancer interface

type Context

type Context interface {
	String() string
	Ip() net.IP
	Port() int
	Sni() string
}

type ReadWriteCount

type ReadWriteCount struct {
	/* Read bytes count */
	CountRead uint

	/* Write bytes count */
	CountWrite uint

	Target Target
}

*

  • Next r/w operation data counters

func (ReadWriteCount) IsZero

func (this ReadWriteCount) IsZero() bool

type Server

type Server interface {
	/**
	 * Start server
	 */
	Start() error

	/**
	 * Stop server and wait until it stop
	 */
	Stop()

	/**
	 * Get server configuration
	 */
	Cfg() config.Server
}

*

  • Server interface

type Service

type Service interface {
	/**
	 * Enable service for Server
	 */
	Enable(Server) error

	/**
	 * Disable service for Server
	 */
	Disable(Server) error
}

*

  • Service is a global facility that could be Enabled or Disabled for a number
  • of core.Server instances, depending on their configration. See services/registry
  • for exact examples.

type Target

type Target struct {
	Host string `json:"host"`
	Port string `json:"port"`
}

*

  • Target host and port

func (*Target) Address

func (this *Target) Address() string

*

  • Get target full address
  • host:port

func (*Target) EqualTo

func (t *Target) EqualTo(other Target) bool

*

  • Compare to other target

func (*Target) String

func (this *Target) String() string

*

  • To String conversion

type TcpContext

type TcpContext struct {
	Hostname string
	/**
	 * Current client connection
	 */
	Conn net.Conn
}

*

  • Proxy tcp context

func (TcpContext) Ip

func (t TcpContext) Ip() net.IP

func (TcpContext) Port

func (t TcpContext) Port() int

func (TcpContext) Sni

func (t TcpContext) Sni() string

func (TcpContext) String

func (t TcpContext) String() string

type UdpContext

type UdpContext struct {
	/**
	 * Current client remote address
	 */
	ClientAddr net.UDPAddr
}

* Proxy udp context

func (UdpContext) Ip

func (u UdpContext) Ip() net.IP

func (UdpContext) Port

func (u UdpContext) Port() int

func (UdpContext) Sni

func (u UdpContext) Sni() string

func (UdpContext) String

func (u UdpContext) String() string

Jump to

Keyboard shortcuts

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