Documentation ¶
Index ¶
- Constants
- func SCTPBind(fd int, addr *SCTPAddr, flags int) error
- func SCTPConnect(fd int, addr *SCTPAddr) (int, error)
- type AssocInfo
- type EventSubscribe
- type GetAddrsOld
- type InitMsg
- type Notification
- type NotificationHandler
- type NotificationHeader
- type RtoInfo
- type SCTPAddr
- type SCTPAssocChangeEvent
- func (s *SCTPAssocChangeEvent) AssocID() SCTPAssocID
- func (s *SCTPAssocChangeEvent) Flags() uint16
- func (s *SCTPAssocChangeEvent) InboundStreams() uint16
- func (s *SCTPAssocChangeEvent) Info() []uint8
- func (s *SCTPAssocChangeEvent) Length() uint32
- func (s *SCTPAssocChangeEvent) OutboundStreams() uint16
- func (s *SCTPAssocChangeEvent) State() SCTPState
- func (s *SCTPAssocChangeEvent) Type() SCTPNotificationType
- type SCTPAssocID
- type SCTPConn
- func (c *SCTPConn) Close() error
- func (c *SCTPConn) GetAssocInfo() (*AssocInfo, error)
- func (c *SCTPConn) GetDefaultSentParam() (*SndRcvInfo, error)
- func (c *SCTPConn) GetReadBuffer() (int, error)
- func (c *SCTPConn) GetRtoInfo() (*RtoInfo, error)
- func (c *SCTPConn) GetWriteBuffer() (int, error)
- func (c *SCTPConn) LocalAddr() net.Addr
- func (c *SCTPConn) PeelOff(id int) (*SCTPConn, error)
- func (c *SCTPConn) Read(b []byte) (int, error)
- func (c *SCTPConn) RemoteAddr() net.Addr
- func (c *SCTPConn) SCTPGetPrimaryPeerAddr() (*SCTPAddr, error)
- func (c *SCTPConn) SCTPLocalAddr(id int) (*SCTPAddr, error)
- func (c *SCTPConn) SCTPRead(b []byte) (int, *SndRcvInfo, Notification, error)
- func (c *SCTPConn) SCTPRemoteAddr(id int) (*SCTPAddr, error)
- func (c *SCTPConn) SCTPWrite(b []byte, info *SndRcvInfo) (int, error)
- func (c *SCTPConn) SetAssocInfo(info AssocInfo) error
- func (c *SCTPConn) SetDeadline(t time.Time) error
- func (c *SCTPConn) SetDefaultSentParam(info *SndRcvInfo) error
- func (c *SCTPConn) SetInitMsg(numOstreams, maxInstreams, maxAttempts, maxInitTimeout int) error
- func (c *SCTPConn) SetNonBlock(nonBlock bool) error
- func (c *SCTPConn) SetReadBuffer(bytes int) error
- func (c *SCTPConn) SetReadDeadline(t time.Time) error
- func (c *SCTPConn) SetReadTimeout(tv syscall.Timeval) error
- func (c *SCTPConn) SetRtoInfo(rtoInfo RtoInfo) error
- func (c *SCTPConn) SetWriteBuffer(bytes int) error
- func (c *SCTPConn) SetWriteDeadline(t time.Time) error
- func (c *SCTPConn) SetWriteTimeout(tv syscall.Timeval) error
- func (c *SCTPConn) SubscribeEvents(flags int) error
- func (c *SCTPConn) SubscribedEvents() (int, error)
- func (c *SCTPConn) Write(b []byte) (int, error)
- type SCTPListener
- type SCTPNotificationType
- type SCTPShutdownEvent
- type SCTPSndRcvInfoWrappedConn
- func (c *SCTPSndRcvInfoWrappedConn) Close() error
- func (c *SCTPSndRcvInfoWrappedConn) GetReadBuffer() (int, error)
- func (c *SCTPSndRcvInfoWrappedConn) GetWriteBuffer() (int, error)
- func (c *SCTPSndRcvInfoWrappedConn) LocalAddr() net.Addr
- func (c *SCTPSndRcvInfoWrappedConn) Read(b []byte) (int, error)
- func (c *SCTPSndRcvInfoWrappedConn) RemoteAddr() net.Addr
- func (c *SCTPSndRcvInfoWrappedConn) SetDeadline(t time.Time) error
- func (c *SCTPSndRcvInfoWrappedConn) SetReadBuffer(bytes int) error
- func (c *SCTPSndRcvInfoWrappedConn) SetReadDeadline(t time.Time) error
- func (c *SCTPSndRcvInfoWrappedConn) SetWriteBuffer(bytes int) error
- func (c *SCTPSndRcvInfoWrappedConn) SetWriteDeadline(t time.Time) error
- func (c *SCTPSndRcvInfoWrappedConn) Write(b []byte) (int, error)
- type SCTPState
- type SndInfo
- type SndRcvInfo
- type SocketConfig
Constants ¶
const ( SOL_SCTP = 132 SCTP_BINDX_ADD_ADDR = 0x01 SCTP_BINDX_REM_ADDR = 0x02 MSG_NOTIFICATION = 0x8000 )
const ( SCTP_RTOINFO = iota SCTP_ASSOCINFO SCTP_INITMSG SCTP_NODELAY SCTP_AUTOCLOSE SCTP_SET_PEER_PRIMARY_ADDR SCTP_PRIMARY_ADDR SCTP_ADAPTATION_LAYER SCTP_DISABLE_FRAGMENTS SCTP_PEER_ADDR_PARAMS SCTP_DEFAULT_SENT_PARAM SCTP_EVENTS SCTP_I_WANT_MAPPED_V4_ADDR SCTP_MAXSEG SCTP_STATUS SCTP_GET_PEER_ADDR_INFO SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK = SCTP_DELAYED_ACK_TIME SCTP_DELAYED_SACK = SCTP_DELAYED_ACK_TIME SCTP_SOCKOPT_BINDX_ADD = 100 SCTP_SOCKOPT_BINDX_REM = 101 SCTP_SOCKOPT_PEELOFF = 102 SCTP_GET_PEER_ADDRS = 108 SCTP_GET_LOCAL_ADDRS = 109 SCTP_SOCKOPT_CONNECTX = 110 SCTP_SOCKOPT_CONNECTX3 = 111 )
const ( SCTP_EVENT_DATA_IO = 1 << iota SCTP_EVENT_ASSOCIATION SCTP_EVENT_ADDRESS SCTP_EVENT_SEND_FAILURE SCTP_EVENT_PEER_ERROR SCTP_EVENT_SHUTDOWN SCTP_EVENT_PARTIAL_DELIVERY SCTP_EVENT_ADAPTATION_LAYER SCTP_EVENT_AUTHENTICATION SCTP_EVENT_SENDER_DRY SCTP_EVENT_ALL = SCTP_EVENT_DATA_IO | SCTP_EVENT_ASSOCIATION | SCTP_EVENT_ADDRESS | SCTP_EVENT_SEND_FAILURE | SCTP_EVENT_PEER_ERROR | SCTP_EVENT_SHUTDOWN | SCTP_EVENT_PARTIAL_DELIVERY | SCTP_EVENT_ADAPTATION_LAYER | SCTP_EVENT_AUTHENTICATION | SCTP_EVENT_SENDER_DRY )
const ( SCTP_SN_TYPE_BASE = SCTPNotificationType(iota + (1 << 15)) SCTP_ASSOC_CHANGE SCTP_PEER_ADDR_CHANGE SCTP_SEND_FAILED SCTP_REMOTE_ERROR SCTP_SHUTDOWN_EVENT SCTP_PARTIAL_DELIVERY_EVENT SCTP_ADAPTATION_INDICATION SCTP_AUTHENTICATION_INDICATION SCTP_SENDER_DRY_EVENT )
const ( SCTP_CMSG_INIT = iota SCTP_CMSG_SNDRCV SCTP_CMSG_SNDINFO SCTP_CMSG_RCVINFO SCTP_CMSG_NXTINFO )
const ( SCTP_UNORDERED = 1 << iota SCTP_ADDR_OVER SCTP_ABORT SCTP_SACK_IMMEDIATELY SCTP_EOF )
const ( SCTP_COMM_UP = SCTPState(iota) SCTP_COMM_LOST SCTP_RESTART SCTP_SHUTDOWN_COMP SCTP_CANT_STR_ASSOC )
const (
SCTP_MAX_STREAM = 0xffff
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssocInfo ¶ added in v1.1.0
type AssocInfo struct { AssocID SCTPAssocID // maximum retransmission attempts to make for the association AsocMaxRxt uint16 // number of destination addresses that the peer has NumberPeerDestinations uint16 // current value of the peer's rwnd (reported in the last selective acknowledgment (SACK)) minus any outstanding data PeerRwnd uint32 // the last reported rwnd that was sent to the peer LocalRwnd uint32 // the association's cookie life value used when issuing cookies CookieLife uint32 }
Association Parameters defined in RFC 6458 8.1
type EventSubscribe ¶
type GetAddrsOld ¶
type Notification ¶ added in v1.1.0
type Notification interface { Type() SCTPNotificationType Flags() uint16 Length() uint32 }
type NotificationHandler ¶
type NotificationHeader ¶
type SCTPAssocChangeEvent ¶ added in v1.1.0
type SCTPAssocChangeEvent struct {
// contains filtered or unexported fields
}
SCTPAssocChangeEvent is an implementation of Notification interface
func (*SCTPAssocChangeEvent) AssocID ¶ added in v1.1.0
func (s *SCTPAssocChangeEvent) AssocID() SCTPAssocID
func (*SCTPAssocChangeEvent) Flags ¶ added in v1.1.0
func (s *SCTPAssocChangeEvent) Flags() uint16
func (*SCTPAssocChangeEvent) InboundStreams ¶ added in v1.1.0
func (s *SCTPAssocChangeEvent) InboundStreams() uint16
func (*SCTPAssocChangeEvent) Info ¶ added in v1.1.0
func (s *SCTPAssocChangeEvent) Info() []uint8
func (*SCTPAssocChangeEvent) Length ¶ added in v1.1.0
func (s *SCTPAssocChangeEvent) Length() uint32
func (*SCTPAssocChangeEvent) OutboundStreams ¶ added in v1.1.0
func (s *SCTPAssocChangeEvent) OutboundStreams() uint16
func (*SCTPAssocChangeEvent) State ¶ added in v1.1.0
func (s *SCTPAssocChangeEvent) State() SCTPState
func (*SCTPAssocChangeEvent) Type ¶ added in v1.1.0
func (s *SCTPAssocChangeEvent) Type() SCTPNotificationType
type SCTPAssocID ¶ added in v1.1.0
type SCTPAssocID int32
type SCTPConn ¶
type SCTPConn struct {
// contains filtered or unexported fields
}
func DialSCTPExt ¶
func DialSCTPExt(network string, laddr, raddr *SCTPAddr, options InitMsg, rtoInfo *RtoInfo, assocInfo *AssocInfo) (*SCTPConn, error)
DialSCTPExt - same as DialSCTP but with given SCTP options
func NewSCTPConn ¶
func NewSCTPConn(fd int, handler NotificationHandler) *SCTPConn
func (*SCTPConn) GetAssocInfo ¶ added in v1.1.0
func (*SCTPConn) GetDefaultSentParam ¶
func (c *SCTPConn) GetDefaultSentParam() (*SndRcvInfo, error)
func (*SCTPConn) GetReadBuffer ¶
func (*SCTPConn) GetRtoInfo ¶ added in v1.1.0
func (*SCTPConn) GetWriteBuffer ¶
func (*SCTPConn) RemoteAddr ¶
func (*SCTPConn) SCTPGetPrimaryPeerAddr ¶
func (*SCTPConn) SCTPRead ¶
func (c *SCTPConn) SCTPRead(b []byte) (int, *SndRcvInfo, Notification, error)
SCTPRead use syscall.Recvmsg to receive SCTP message and return sctp sndrcvinfo/notification if need
func (*SCTPConn) SetAssocInfo ¶ added in v1.1.0
func (*SCTPConn) SetDefaultSentParam ¶
func (c *SCTPConn) SetDefaultSentParam(info *SndRcvInfo) error
func (*SCTPConn) SetInitMsg ¶
func (*SCTPConn) SetNonBlock ¶ added in v1.1.0
func (*SCTPConn) SetReadBuffer ¶
func (*SCTPConn) SetReadTimeout ¶ added in v1.1.0
func (*SCTPConn) SetRtoInfo ¶ added in v1.1.0
func (*SCTPConn) SetWriteBuffer ¶
func (*SCTPConn) SetWriteTimeout ¶ added in v1.1.0
func (*SCTPConn) SubscribeEvents ¶
func (*SCTPConn) SubscribedEvents ¶
type SCTPListener ¶
type SCTPListener struct {
// contains filtered or unexported fields
}
func ListenSCTP ¶
func ListenSCTP(net string, laddr *SCTPAddr) (*SCTPListener, error)
ListenSCTP - start listener on specified address/port
func ListenSCTPExt ¶
func ListenSCTPExt(network string, laddr *SCTPAddr, options InitMsg, rtoInfo *RtoInfo, assocInfo *AssocInfo) (*SCTPListener, error)
ListenSCTPExt - start listener on specified address/port with given SCTP options
func (*SCTPListener) Accept ¶
func (ln *SCTPListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection connection to the listener.
func (*SCTPListener) AcceptSCTP ¶
func (ln *SCTPListener) AcceptSCTP() (*SCTPConn, error)
AcceptSCTP waits for and returns the next SCTP connection to the listener. it will use EpollWait to wait for a incoming connection then call syscall.Accept4 to accept
func (*SCTPListener) Addr ¶
func (ln *SCTPListener) Addr() net.Addr
func (*SCTPListener) Close ¶
func (ln *SCTPListener) Close() error
type SCTPNotificationType ¶
type SCTPNotificationType int
type SCTPShutdownEvent ¶ added in v1.1.0
type SCTPShutdownEvent struct {
// contains filtered or unexported fields
}
SCTPShutdownEvent is an implementation of Notification interface
func (*SCTPShutdownEvent) AssocID ¶ added in v1.1.0
func (s *SCTPShutdownEvent) AssocID() SCTPAssocID
func (*SCTPShutdownEvent) Flags ¶ added in v1.1.0
func (s *SCTPShutdownEvent) Flags() uint16
func (*SCTPShutdownEvent) Length ¶ added in v1.1.0
func (s *SCTPShutdownEvent) Length() uint32
func (*SCTPShutdownEvent) Type ¶ added in v1.1.0
func (s *SCTPShutdownEvent) Type() SCTPNotificationType
type SCTPSndRcvInfoWrappedConn ¶
type SCTPSndRcvInfoWrappedConn struct {
// contains filtered or unexported fields
}
func NewSCTPSndRcvInfoWrappedConn ¶
func NewSCTPSndRcvInfoWrappedConn(conn *SCTPConn) *SCTPSndRcvInfoWrappedConn
func (*SCTPSndRcvInfoWrappedConn) Close ¶
func (c *SCTPSndRcvInfoWrappedConn) Close() error
func (*SCTPSndRcvInfoWrappedConn) GetReadBuffer ¶
func (c *SCTPSndRcvInfoWrappedConn) GetReadBuffer() (int, error)
func (*SCTPSndRcvInfoWrappedConn) GetWriteBuffer ¶
func (c *SCTPSndRcvInfoWrappedConn) GetWriteBuffer() (int, error)
func (*SCTPSndRcvInfoWrappedConn) LocalAddr ¶
func (c *SCTPSndRcvInfoWrappedConn) LocalAddr() net.Addr
func (*SCTPSndRcvInfoWrappedConn) Read ¶
func (c *SCTPSndRcvInfoWrappedConn) Read(b []byte) (int, error)
func (*SCTPSndRcvInfoWrappedConn) RemoteAddr ¶
func (c *SCTPSndRcvInfoWrappedConn) RemoteAddr() net.Addr
func (*SCTPSndRcvInfoWrappedConn) SetDeadline ¶
func (c *SCTPSndRcvInfoWrappedConn) SetDeadline(t time.Time) error
func (*SCTPSndRcvInfoWrappedConn) SetReadBuffer ¶
func (c *SCTPSndRcvInfoWrappedConn) SetReadBuffer(bytes int) error
func (*SCTPSndRcvInfoWrappedConn) SetReadDeadline ¶
func (c *SCTPSndRcvInfoWrappedConn) SetReadDeadline(t time.Time) error
func (*SCTPSndRcvInfoWrappedConn) SetWriteBuffer ¶
func (c *SCTPSndRcvInfoWrappedConn) SetWriteBuffer(bytes int) error
func (*SCTPSndRcvInfoWrappedConn) SetWriteDeadline ¶
func (c *SCTPSndRcvInfoWrappedConn) SetWriteDeadline(t time.Time) error
type SndRcvInfo ¶
type SocketConfig ¶
type SocketConfig struct { // If Control is not nil it is called after the socket is created but before // it is bound or connected. Control func(network, address string, c syscall.RawConn) error // InitMsg is the options to send in the initial SCTP message InitMsg InitMsg // RtoInfo RtoInfo *RtoInfo // AssocInfo (RFC 6458) AssocInfo *AssocInfo }
SocketConfig contains options for the SCTP socket.
func (*SocketConfig) Dial ¶
func (cfg *SocketConfig) Dial(net string, laddr, raddr *SCTPAddr) (*SCTPConn, error)
func (*SocketConfig) Listen ¶
func (cfg *SocketConfig) Listen(net string, laddr *SCTPAddr) (*SCTPListener, error)