tcp

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOption = &Options{
	Timeout:         time.Second * 5,
	KeepAlive:       true,
	KeepAlivePeriod: time.Minute,
	Linger:          -1,
	NoDelay:         true,
}

DefaultOption default tcp options

Functions

func New

func New() transport.Factory

New tcp factory

func WithOptions

func WithOptions(option *Options) transport.Option

WithOptions to wrap the tcp options

Types

type Options

type Options struct {
	Timeout         time.Duration `json:"timeout"`
	KeepAlive       bool          `json:"keep-alive,string"`
	KeepAlivePeriod time.Duration `json:"keep-alive-period"`
	Linger          int           `json:"linger,string"`
	NoDelay         bool          `json:"nodelay,string"`
	SockBuf         int           `json:"sockbuf,string"`
}

Options fot tcp transport

func FromContext

func FromContext(ctx context.Context, def *Options) *Options

FromContext to unwrap the tcp options

Jump to

Keyboard shortcuts

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