network

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 32 Imported by: 19

Documentation

Index

Constants

View Source
const (
	DefaultBufferReadCapacity = 1 << 7

	NetBufferDefaultSize     = 0
	NetBufferDefaultCapacity = 1 << 4

	DefaultConnectTimeout = 3 * time.Second
)

Network related const

View Source
const (
	V4Only uint8 = iota
	V6Only
	Auto
)

Variables

View Source
var ConnNewPoolFactories map[types.ProtocolName]connNewPool
View Source
var DefaultResolverFile string = "/etc/resolv.conf"
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() api.RequestInfo

NewrequestInfo

func NewServerConnection

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

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

func RegisterNewPoolFactory

func RegisterNewPoolFactory(protocol types.ProtocolName, 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 DnsResolver added in v0.13.0

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

func NewDnsResolver added in v0.13.0

func NewDnsResolver(config *v2.DnsResolverConfig) *DnsResolver

func NewDnsResolverFromFile added in v0.13.0

func NewDnsResolverFromFile(configFile string, resolverPort string) *DnsResolver

func (*DnsResolver) DnsResolve added in v0.13.0

func (dr *DnsResolver) DnsResolve(dnsAddr string, dnsLookupFamily v2.DnsLookupFamily) *[]DnsResponse

type DnsResponse added in v0.13.0

type DnsResponse struct {
	Address string
	Ttl     time.Duration
}

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 api.ResponseFlag) bool

func (*RequestInfo) IsHealthCheck

func (r *RequestInfo) IsHealthCheck() bool

func (*RequestInfo) OnUpstreamHostSelected

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

func (*RequestInfo) ProcessTimeDuration

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

func (*RequestInfo) Protocol

func (r *RequestInfo) Protocol() api.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() api.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) SetProcessTimeDuration

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

func (*RequestInfo) SetProtocol added in v0.12.0

func (r *RequestInfo) SetProtocol(p api.Protocol)

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 api.ResponseFlag)

func (*RequestInfo) SetResponseReceivedDuration

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

func (*RequestInfo) SetRouteEntry

func (r *RequestInfo) SetRouteEntry(routerRule api.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() api.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