network

package
v0.0.0-...-cb950d2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBufferReadCapacity = 1 << 7

	NetBufferDefaultSize     = 0
	NetBufferDefaultCapacity = 1 << 4

	DefaultIdleTimeout    = 90 * time.Second
	DefaultConnectTimeout = 3 * time.Second
)

Network related const

Variables

View Source
var ConnNewPoolFactories map[types.Protocol]connNewPool
View Source
var TransferTimeout = time.Second * 30 //default 30s

TransferTimeout is the total transfer time

View Source
var (
	// UseNetpollMode indicates which mode should be used for connection IO processing
	UseNetpollMode = false
)

Functions

func NewClientConnection

func NewClientConnection(sourceAddr net.Addr, connectTimeout time.Duration, tlsMng types.TLSContextManager, remoteAddr net.Addr, stopChan chan struct{}) types.ClientConnection

NewClientConnection new client-side connection

func NewListener

func NewListener(lc *v2.Listener) types.Listener

func NewRequestInfo

func NewRequestInfo() types.RequestInfo

NewrequestInfo

func NewServerConnection

func NewServerConnection(ctx context.Context, rawc net.Conn, stopChan chan struct{}) types.Connection

NewServerConnection new server-side connection, rawc is the raw connection from go/net

func RegisterNewPoolFactory

func RegisterNewPoolFactory(protocol types.Protocol, factory connNewPool)

func SetTransferTimeout

func SetTransferTimeout(time time.Duration)

func TransferServer

func TransferServer(handler types.ConnectionHandler)

TransferServer is called on new mosn start

Types

type ListenerState

type ListenerState int
const (
	ListenerInited ListenerState = iota
	ListenerRunning
	ListenerStopped
)

listener state ListenerInited means listener is inited, a inited listener can be started or stopped ListenerRunning means listener is running, start a running listener will be ignored. ListenerStopped means listener is stopped, start a stopped listener without restart flag will be ignored.

type RequestInfo

type RequestInfo struct {
	// contains filtered or unexported fields
}

RequestInfo

func (*RequestInfo) BytesReceived

func (r *RequestInfo) BytesReceived() uint64

func (*RequestInfo) BytesSent

func (r *RequestInfo) BytesSent() uint64

func (*RequestInfo) DownstreamLocalAddress

func (r *RequestInfo) DownstreamLocalAddress() net.Addr

func (*RequestInfo) DownstreamRemoteAddress

func (r *RequestInfo) DownstreamRemoteAddress() net.Addr

func (*RequestInfo) Duration

func (r *RequestInfo) Duration() time.Duration

func (*RequestInfo) GetResponseFlag

func (r *RequestInfo) GetResponseFlag(flag types.ResponseFlag) bool

func (*RequestInfo) IsHealthCheck

func (r *RequestInfo) IsHealthCheck() bool

func (*RequestInfo) OnUpstreamHostSelected

func (r *RequestInfo) OnUpstreamHostSelected(host types.HostInfo)

func (*RequestInfo) Protocol

func (r *RequestInfo) Protocol() types.Protocol

func (*RequestInfo) RequestFinishedDuration

func (r *RequestInfo) RequestFinishedDuration() time.Duration

func (*RequestInfo) RequestReceivedDuration

func (r *RequestInfo) RequestReceivedDuration() time.Duration

func (*RequestInfo) ResponseCode

func (r *RequestInfo) ResponseCode() int

func (*RequestInfo) ResponseReceivedDuration

func (r *RequestInfo) ResponseReceivedDuration() time.Duration

func (*RequestInfo) RouteEntry

func (r *RequestInfo) RouteEntry() types.RouteRule

func (*RequestInfo) SetBytesReceived

func (r *RequestInfo) SetBytesReceived(bytesReceived uint64)

func (*RequestInfo) SetBytesSent

func (r *RequestInfo) SetBytesSent(bytesSent uint64)

func (*RequestInfo) SetDownstreamLocalAddress

func (r *RequestInfo) SetDownstreamLocalAddress(addr net.Addr)

func (*RequestInfo) SetDownstreamRemoteAddress

func (r *RequestInfo) SetDownstreamRemoteAddress(addr net.Addr)

func (*RequestInfo) SetHealthCheck

func (r *RequestInfo) SetHealthCheck(isHc bool)

func (*RequestInfo) SetRequestFinishedDuration

func (r *RequestInfo) SetRequestFinishedDuration(t time.Time)

func (*RequestInfo) SetRequestReceivedDuration

func (r *RequestInfo) SetRequestReceivedDuration(t time.Time)

func (*RequestInfo) SetResponseCode

func (r *RequestInfo) SetResponseCode(code int)

func (*RequestInfo) SetResponseFlag

func (r *RequestInfo) SetResponseFlag(flag types.ResponseFlag)

func (*RequestInfo) SetResponseReceivedDuration

func (r *RequestInfo) SetResponseReceivedDuration(t time.Time)

func (*RequestInfo) SetRouteEntry

func (r *RequestInfo) SetRouteEntry(routerRule types.RouteRule)

func (*RequestInfo) SetStartTime

func (r *RequestInfo) SetStartTime()

func (*RequestInfo) SetUpstreamLocalAddress

func (r *RequestInfo) SetUpstreamLocalAddress(addr string)

func (*RequestInfo) StartTime

func (r *RequestInfo) StartTime() time.Time

func (*RequestInfo) UpstreamHost

func (r *RequestInfo) UpstreamHost() types.HostInfo

func (*RequestInfo) UpstreamLocalAddress

func (r *RequestInfo) UpstreamLocalAddress() string

Jump to

Keyboard shortcuts

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