package tcpopt

Import Path
	github.com/mikioh/tcpopt (on go.dev)

Dependency Relation
	imports 6 packages, and imported by 2 packages

Involved Source Files Package tcpopt implements encoding and decoding of TCP-level socket options. option.go parse.go sys.go sys_linux.go sys_unix.go zsys_linux_generic.go
Code Examples package main import ( "log" "net" "time" "github.com/mikioh/tcp" "github.com/mikioh/tcpopt" ) func main() { c, err := net.Dial("tcp", "golang.org:80") if err != nil { log.Fatal(err) } defer c.Close() tc, err := tcp.NewConn(c) if err != nil { log.Fatal(err) } if err := tc.SetOption(tcpopt.KeepAlive(true)); err != nil { log.Fatal(err) } if err := tc.SetOption(tcpopt.KeepAliveIdleInterval(3 * time.Minute)); err != nil { log.Fatal(err) } if err := tc.SetOption(tcpopt.KeepAliveProbeInterval(30 * time.Second)); err != nil { log.Fatal(err) } if err := tc.SetOption(tcpopt.KeepAliveProbeCount(3)); err != nil { log.Fatal(err) } }
Package-Level Type Names (total 13)
/* sort by: | */
Cork specifies the use of TCP_CORK or TCP_NOPUSH option. On DragonFly BSD, the caller may need to adjust the net.inet.tcp.disable_nopush kernel state. NetBSD and Windows don't support this option. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. Cork : Option Cork : github.com/gogo/protobuf/proto.Marshaler Cork : github.com/golang/protobuf/proto.Marshaler
ECN specifies the use of ECN. Only Darwin supports this option. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. ECN : Option ECN : github.com/gogo/protobuf/proto.Marshaler ECN : github.com/golang/protobuf/proto.Marshaler
Error represents an error on the socket. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. Error : Option Error : github.com/gogo/protobuf/proto.Marshaler Error : github.com/golang/protobuf/proto.Marshaler
KeepAlive specifies the use of keep alive. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. KeepAlive : Option KeepAlive : github.com/gogo/protobuf/proto.Marshaler KeepAlive : github.com/golang/protobuf/proto.Marshaler
KeepAliveIdleInterval is the idle interval until the first probe is sent. OpenBSD doesn't support this option. See TCP_KEEPIDLE or TCP_KEEPALIVE for further information. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. KeepAliveIdleInterval : Option KeepAliveIdleInterval : github.com/gogo/protobuf/proto.Marshaler KeepAliveIdleInterval : github.com/golang/protobuf/proto.Marshaler
KeepAliveProbeCount is the number of keepalive probes should be repeated when the peer is not responding. OpenBSD and Windows don't support this option. See TCP_KEEPCNT for further information. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. KeepAliveProbeCount : Option KeepAliveProbeCount : github.com/gogo/protobuf/proto.Marshaler KeepAliveProbeCount : github.com/golang/protobuf/proto.Marshaler
KeepAliveProbeInterval is the interval between keepalive probes. OpenBSD doesn't support this option. See TCP_KEEPINTVL for further information. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. KeepAliveProbeInterval : Option KeepAliveProbeInterval : github.com/gogo/protobuf/proto.Marshaler KeepAliveProbeInterval : github.com/golang/protobuf/proto.Marshaler
MSS specifies the maximum segment size. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. MSS : Option MSS : github.com/gogo/protobuf/proto.Marshaler MSS : github.com/golang/protobuf/proto.Marshaler
NoDelay specifies the use of Nagle's algorithm. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. NoDelay : Option NoDelay : github.com/gogo/protobuf/proto.Marshaler NoDelay : github.com/golang/protobuf/proto.Marshaler
NotSentLowWMK specifies the amount of unsent bytes in transmission queue. The network poller such as kqueue or epoll doesn't report that the connection is writable while the amount of unsent data size is greater than NotSentLowWMK. Only Darwin and Linux support this option. See TCP_NOTSENT_LOWAT for further information. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. NotSentLowWMK : Option NotSentLowWMK : github.com/gogo/protobuf/proto.Marshaler NotSentLowWMK : github.com/golang/protobuf/proto.Marshaler
An Option represents a socket option. Level returns the platform-specific socket option level. Marshal returns the binary encoding of socket option. Name returns the platform-specific socket option name. Cork ECN Error KeepAlive KeepAliveIdleInterval KeepAliveProbeCount KeepAliveProbeInterval MSS NoDelay NotSentLowWMK ReceiveBuffer SendBuffer github.com/mikioh/tcpinfo.CCAlgorithm *github.com/mikioh/tcpinfo.CCInfo *github.com/mikioh/tcpinfo.Info Option : github.com/gogo/protobuf/proto.Marshaler Option : github.com/golang/protobuf/proto.Marshaler func Parse(level, name int, b []byte) (Option, error) func github.com/marten-seemann/tcp.(*Conn).Option(level, name int, b []byte) (Option, error) func github.com/marten-seemann/tcp.(*Conn).SetOption(o Option) error
ReceiveBuffer specifies the size of receive buffer. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. ReceiveBuffer : Option ReceiveBuffer : github.com/gogo/protobuf/proto.Marshaler ReceiveBuffer : github.com/golang/protobuf/proto.Marshaler
SendBuffer specifies the size of send buffer. Level implements the Level method of Option interface. Marshal implements the Marshal method of Option interface. Name implements the Name method of Option interface. SendBuffer : Option SendBuffer : github.com/gogo/protobuf/proto.Marshaler SendBuffer : github.com/golang/protobuf/proto.Marshaler
Package-Level Functions (total 3)
Parse parses a socket option.
Register registers a socket option parser.
Unregister unregisters a socket option parser.