Documentation
¶
Overview ¶
Package sctp implements the SCTP spec
Index ¶
- Constants
- Variables
- func GenerateOutOfBandToken(opts ...ClientOption) ([]byte, error)
- func TryMarshalUnmarshal(msg []byte) int
- type Association
- func (a *Association) Abort(reason string)
- func (a *Association) AcceptStream() (*Stream, error)
- func (a *Association) ActiveHeartbeat()
- func (a *Association) BufferedAmount() int
- func (a *Association) BytesReceived() uint64
- func (a *Association) BytesSent() uint64
- func (a *Association) CWND() uint32
- func (a *Association) Close() error
- func (a *Association) MTU() uint32
- func (a *Association) MaxMessageSize() uint32
- func (a *Association) OpenStream(streamIdentifier uint16, defaultPayloadType PayloadProtocolIdentifier) (*Stream, error)
- func (a *Association) RWND() uint32
- func (a *Association) SRTT() float64
- func (a *Association) SetMaxMessageSize(maxMsgSize uint32)
- func (a *Association) Shutdown(ctx context.Context) error
- type AssociationOption
- func WithBlockWrite(b bool) AssociationOption
- func WithCwndCAStep(cwndCAStep uint32) AssociationOption
- func WithEnableZeroChecksum(b bool) AssociationOption
- func WithFastRtxWnd(fastRtxWnd uint32) AssociationOption
- func WithLoggerFactory(loggerFactory logging.LoggerFactory) AssociationOption
- func WithMTU(size uint32) AssociationOption
- func WithMaxMessageSize(size uint32) AssociationOption
- func WithMaxReceiveBufferSize(size uint32) AssociationOption
- func WithMinCwnd(minCwnd uint32) AssociationOption
- func WithName(name string) AssociationOption
- func WithNetConn(conn net.Conn) AssociationOption
- func WithRACKOptions(opts ...AssociationRACKOption) AssociationOption
- func WithRTOMax(rtoMax float64) AssociationOption
- func WithSNAP(localSctpInit []byte, remoteSctpInit []byte) AssociationOption
- type AssociationRACKOption
- type ClientOption
- type Config
- type PayloadProtocolIdentifier
- type ServerOption
- type Stream
- func (s *Stream) BufferedAmount() uint64
- func (s *Stream) BufferedAmountLowThreshold() uint64
- func (s *Stream) Close() error
- func (s *Stream) OnBufferedAmountLow(f func())
- func (s *Stream) Read(p []byte) (int, error)
- func (s *Stream) ReadSCTP(payload []byte) (int, PayloadProtocolIdentifier, error)
- func (s *Stream) SetBufferedAmountLowThreshold(th uint64)
- func (s *Stream) SetDeadline(t time.Time) error
- func (s *Stream) SetDefaultPayloadType(defaultPayloadType PayloadProtocolIdentifier)
- func (s *Stream) SetReadDeadline(deadline time.Time) error
- func (s *Stream) SetReliabilityParams(unordered bool, relType byte, relVal uint32)
- func (s *Stream) SetWriteDeadline(deadline time.Time) error
- func (s *Stream) State() StreamState
- func (s *Stream) StreamIdentifier() uint16
- func (s *Stream) Write(payload []byte) (n int, err error)
- func (s *Stream) WriteSCTP(payload []byte, ppi PayloadProtocolIdentifier) (int, error)
- type StreamState
Constants ¶
const ( // ReliabilityTypeReliable is used for reliable transmission. ReliabilityTypeReliable byte = 0 // ReliabilityTypeRexmit is used for partial reliability by retransmission count. ReliabilityTypeRexmit byte = 1 // ReliabilityTypeTimed is used for partial reliability by retransmission duration. ReliabilityTypeTimed byte = 2 )
Variables ¶
var ( ErrChunk = errors.New("abort chunk, with following errors") ErrShutdownNonEstablished = errors.New("shutdown called in non-established state") ErrAssociationClosedBeforeConn = errors.New("association closed before connecting") ErrAssociationClosed = errors.New("association closed") ErrSilentlyDiscard = errors.New("silently discard") ErrInitNotStoredToSend = errors.New("the init not stored to send") ErrCookieEchoNotStoredToSend = errors.New("cookieEcho not stored to send") ErrSCTPPacketSourcePortZero = errors.New("sctp packet must not have a source port of 0") ErrSCTPPacketDestinationPortZero = errors.New("sctp packet must not have a destination port of 0") ErrInitChunkBundled = errors.New("init chunk must not be bundled with any other chunk") ErrInitChunkVerifyTagNotZero = errors.New( "init chunk expects a verification tag of 0 on the packet when out-of-the-blue", ) ErrHandleInitState = errors.New("todo: handle Init when in state") ErrInitAckNoCookie = errors.New("no cookie in InitAck") ErrInflightQueueTSNPop = errors.New("unable to be popped from inflight queue TSN") ErrTSNRequestNotExist = errors.New("requested non-existent TSN") ErrResetPacketInStateNotExist = errors.New("sending reset packet in non-established state") ErrParamterType = errors.New("unexpected parameter type") ErrPayloadDataStateNotExist = errors.New("sending payload data in non-established state") ErrChunkTypeUnhandled = errors.New("unhandled chunk type") ErrHandshakeInitAck = errors.New("handshake failed (INIT ACK)") ErrHandshakeCookieEcho = errors.New("handshake failed (COOKIE ECHO)") ErrTooManyReconfigRequests = errors.New("too many outstanding reconfig requests") )
Association errors.
var ( ErrChunkTypeNotAbort = errors.New("ChunkType is not of type ABORT") ErrBuildAbortChunkFailed = errors.New("failed build Abort Chunk") )
Abort chunk errors.
var ( ErrChunkTypeNotCtError = errors.New("ChunkType is not of type ctError") ErrBuildErrorChunkFailed = errors.New("failed build Error Chunk") )
Error chunk errors.
var ( ErrMarshalStreamFailed = errors.New("failed to marshal stream") ErrChunkTooShort = errors.New("chunk too short") )
Forward TSN chunk errors.
var ( ErrChunkTypeNotHeartbeat = errors.New("ChunkType is not of type HEARTBEAT") ErrHeartbeatNotLongEnoughInfo = errors.New("heartbeat is not long enough to contain Heartbeat Info") ErrParseParamTypeFailed = errors.New("failed to parse param type") ErrHeartbeatParam = errors.New("heartbeat should only have HEARTBEAT param") ErrHeartbeatChunkUnmarshal = errors.New("failed unmarshalling param in Heartbeat Chunk") ErrHeartbeatExtraNonZero = errors.New("heartbeat has non-zero trailing bytes after last parameter") ErrHeartbeatMarshalNoInfo = errors.New("heartbeat marshal requires exactly one Heartbeat Info parameter") )
Heartbeat chunk errors.
var ( // Deprecated: this error is no longer used but is kept for compatibility. ErrUnimplemented = errors.New("unimplemented") ErrChunkTypeNotHeartbeatAck = errors.New("chunk type is not of type HEARTBEAT ACK") ErrHeartbeatAckParams = errors.New("heartbeat Ack must have one param") ErrHeartbeatAckNotHeartbeatInfo = errors.New("heartbeat Ack must have one param, and it should be a HeartbeatInfo") ErrHeartbeatAckMarshalParam = errors.New("unable to marshal parameter for Heartbeat Ack") )
Heartbeat ack chunk errors.
var ( ErrChunkTypeNotTypeInit = errors.New("ChunkType is not of type INIT") ErrChunkValueNotLongEnough = errors.New("chunk Value isn't long enough for mandatory parameters exp") ErrChunkTypeInitFlagZero = errors.New("ChunkType of type INIT flags must be all 0") ErrChunkTypeInitUnmarshalFailed = errors.New("failed to unmarshal INIT body") ErrChunkTypeInitMarshalFailed = errors.New("failed marshaling INIT common data") ErrChunkTypeInitInitateTagZero = errors.New("ChunkType of type INIT ACK InitiateTag must not be 0") ErrInitInboundStreamRequestZero = errors.New("INIT ACK inbound stream request must be > 0") ErrInitOutboundStreamRequestZero = errors.New("INIT ACK outbound stream request must be > 0") ErrInitAdvertisedReceiver1500 = errors.New("INIT ACK Advertised Receiver Window Credit (a_rwnd) must be >= 1500") ErrInitUnknownParam = errors.New("INIT with unknown param") )
Init chunk errors.
var ( ErrChunkTypeNotInitAck = errors.New("ChunkType is not of type INIT ACK") ErrChunkNotLongEnoughForParams = errors.New("chunk Value isn't long enough for mandatory parameters exp") ErrChunkTypeInitAckFlagZero = errors.New("ChunkType of type INIT ACK flags must be all 0") ErrInitAckUnmarshalFailed = errors.New("failed to unmarshal INIT body") ErrInitCommonDataMarshalFailed = errors.New("failed marshaling INIT common data") ErrChunkTypeInitAckInitateTagZero = errors.New("ChunkType of type INIT ACK InitiateTag must not be 0") ErrInitAckInboundStreamRequestZero = errors.New("INIT ACK inbound stream request must be > 0") ErrInitAckOutboundStreamRequestZero = errors.New("INIT ACK outbound stream request must be > 0") ErrInitAckAdvertisedReceiver1500 = errors.New("INIT ACK Advertised Receiver Window Credit (a_rwnd) must be >= 1500") )
Init ack chunk errors.
var ( ErrInitChunkParseParamTypeFailed = errors.New("failed to parse param type") ErrInitAckMarshalParam = errors.New("unable to marshal parameter for INIT/INITACK") )
Init chunk errors.
var ( ErrChunkParseParamTypeFailed = errors.New("failed to parse param type") ErrChunkMarshalParamAReconfigFailed = errors.New("unable to marshal parameter A for reconfig") ErrChunkMarshalParamBReconfigFailed = errors.New("unable to marshal parameter B for reconfig") )
Reconfigure chunk errors.
var ( ErrChunkTypeNotSack = errors.New("ChunkType is not of type SACK") ErrSackSizeNotLargeEnoughInfo = errors.New("SACK Chunk size is not large enough to contain header") ErrSackSizeNotMatchPredicted = errors.New("SACK Chunk size does not match predicted amount from header values") )
Selective ack chunk errors.
var ( ErrInvalidChunkSize = errors.New("invalid chunk size") ErrChunkTypeNotShutdown = errors.New("ChunkType is not of type SHUTDOWN") )
Shutdown chunk errors.
var ( ErrChunkHeaderTooSmall = errors.New("raw is too small for a SCTP chunk") ErrChunkHeaderNotEnoughSpace = errors.New("not enough data left in SCTP packet to satisfy requested length") ErrChunkHeaderPaddingNonZero = errors.New("chunk padding is non-zero at offset") )
SCTP chunk header errors.
var ( ErrPacketRawTooSmall = errors.New("raw is smaller than the minimum length for a SCTP packet") ErrParseSCTPChunkNotEnoughData = errors.New("unable to parse SCTP chunk, not enough data for complete header") ErrUnmarshalUnknownChunkType = errors.New("failed to unmarshal, contains unknown chunk type") ErrChecksumMismatch = errors.New("checksum mismatch theirs") )
SCTP packet errors.
var ( ErrParamHeaderTooShort = errors.New("param header too short") ErrParamHeaderSelfReportedLengthShorter = errors.New("param self reported length is shorter than header length") ErrParamHeaderSelfReportedLengthLonger = errors.New("param self reported length is longer than header length") ErrParamHeaderParseFailed = errors.New("failed to parse param type") )
Parameter header parse errors.
var ( ErrUnexpectedChunkPoppedUnordered = errors.New("unexpected chunk popped (unordered)") ErrUnexpectedChunkPoppedOrdered = errors.New("unexpected chunk popped (ordered)") ErrUnexpectedQState = errors.New("unexpected q state (should've been selected)") // Deprecated: use ErrUnexpectedChunkPoppedUnordered. ErrUnexpectedChuckPoppedUnordered = ErrUnexpectedChunkPoppedUnordered // Deprecated: use ErrUnexpectedChunkPoppedOrdered. ErrUnexpectedChuckPoppedOrdered = ErrUnexpectedChunkPoppedOrdered )
Pending queue errors.
var ( ErrOutboundPacketTooLarge = errors.New("outbound packet larger than maximum message size") ErrStreamClosed = errors.New("stream closed") ErrReadDeadlineExceeded = fmt.Errorf("read deadline exceeded: %w", os.ErrDeadlineExceeded) )
SCTP stream errors.
var (
ErrBuildErrorCaseHandle = errors.New("BuildErrorCause does not handle")
)
Error and abort chunk errors.
var (
ErrChunkPayloadSmall = errors.New("packet is smaller than the header size")
)
Data chunk errors.
var (
ErrChunkTypeNotCookieAck = errors.New("ChunkType is not of type COOKIEACK")
)
Cookie ack chunk errors.
var (
ErrChunkTypeNotCookieEcho = errors.New("ChunkType is not of type COOKIEECHO")
)
Cookie echo chunk errors.
var (
ErrChunkTypeNotShutdownAck = errors.New("ChunkType is not of type SHUTDOWN-ACK")
)
Shutdown ack chunk errors.
var (
ErrChunkTypeNotShutdownComplete = errors.New("ChunkType is not of type SHUTDOWN-COMPLETE")
)
Shutdown complete chunk errors.
var ErrInvalidAlgorithmType = errors.New("invalid algorithm type")
ErrInvalidAlgorithmType is returned if unknown auth algorithm is specified.
var ErrInvalidChunkLength = errors.New("invalid chunk length")
ErrInvalidChunkLength is returned if the chunk length is invalid.
var ErrInvalidSCTPChunk = errors.New("invalid SCTP chunk")
ErrInvalidSCTPChunk is returned when an SCTP chunk is invalid.
var (
ErrParamPacketTooShort = errors.New("packet too short")
)
Parameter packet errors.
var ErrParamTypeUnhandled = errors.New("unhandled ParamType")
ErrParamTypeUnhandled is returned if unknown parameter type is specified.
var (
ErrProtocolViolationUnmarshal = errors.New("unable to unmarshal Protocol Violation error")
)
Abort chunk errors.
var (
ErrReconfigRespParamTooShort = errors.New("reconfig response parameter too short")
)
Reconfiguration response errors.
var (
ErrSSNResetRequestParamTooShort = errors.New("outgoing SSN reset request parameter too short")
)
Outgoing reset request parameter errors.
var (
ErrZeroChecksumParamTooShort = errors.New("zero checksum parameter too short")
)
Zero Checksum parameter error.
Functions ¶
func GenerateOutOfBandToken ¶ added in v1.9.4
func GenerateOutOfBandToken(opts ...ClientOption) ([]byte, error)
GenerateOutOfBandToken generates an out-of-band connection token (i.e. a serialized SCTP INIT chunk) for use with SNAP.
func TryMarshalUnmarshal ¶ added in v1.8.19
TryMarshalUnmarshal attempts to marshal and unmarshal a message. Added for fuzzing.
Types ¶
type Association ¶
type Association struct {
// contains filtered or unexported fields
}
Association represents an SCTP association 13.2. Parameters Necessary per Association (i.e., the TCB)
Peer : Tag value to be sent in every packet and is received
Verification: in the INIT or INIT ACK chunk.
Tag :
State : A state variable indicating what state the association
: is in, i.e., COOKIE-WAIT, COOKIE-ECHOED, ESTABLISHED,
: SHUTDOWN-PENDING, SHUTDOWN-SENT, SHUTDOWN-RECEIVED,
: SHUTDOWN-ACK-SENT.
Note: No "CLOSED" state is illustrated since if a association is "CLOSED" its TCB SHOULD be removed. Note: By nature of an Association being constructed with one net.Conn, it is not a multi-home supporting implementation of SCTP.
func Client
deprecated
func Client(config Config) (*Association, error)
Client opens a SCTP stream over a conn.
Deprecated: Use ClientWithOptions instead.
func ClientWithOptions ¶ added in v1.9.3
func ClientWithOptions(opts ...ClientOption) (*Association, error)
ClientWithOptions opens a SCTP stream over a conn.
func Server
deprecated
func Server(config Config) (*Association, error)
Server accepts a SCTP stream over a conn.
Deprecated: Use ServerWithOptions instead.
func ServerWithOptions ¶ added in v1.9.3
func ServerWithOptions(opts ...ServerOption) (*Association, error)
ServerWithOptions accepts a SCTP stream over a conn.
func (*Association) Abort ¶ added in v1.8.3
func (a *Association) Abort(reason string)
Abort sends the abort packet with user initiated abort and immediately closes the connection.
func (*Association) AcceptStream ¶
func (a *Association) AcceptStream() (*Stream, error)
AcceptStream accepts a stream.
func (*Association) ActiveHeartbeat ¶ added in v1.9.0
func (a *Association) ActiveHeartbeat()
ActiveHeartbeat sends a HEARTBEAT chunk on the association to perform an on-demand RTT measurement without application payload.
It is safe to call from outside; it will take the association lock and be a no-op if the association is not established.
func (*Association) BufferedAmount ¶ added in v1.8.38
func (a *Association) BufferedAmount() int
BufferedAmount returns total amount (in bytes) of currently buffered user data.
func (*Association) BytesReceived ¶ added in v1.6.8
func (a *Association) BytesReceived() uint64
BytesReceived returns the number of bytes received.
func (*Association) BytesSent ¶ added in v1.6.8
func (a *Association) BytesSent() uint64
BytesSent returns the number of bytes sent.
func (*Association) CWND ¶ added in v1.8.7
func (a *Association) CWND() uint32
CWND returns the association's current congestion window (cwnd).
func (*Association) Close ¶
func (a *Association) Close() error
Close ends the SCTP Association and cleans up any state.
func (*Association) MTU ¶ added in v1.8.7
func (a *Association) MTU() uint32
MTU returns the association's current MTU.
func (*Association) MaxMessageSize ¶ added in v1.7.10
func (a *Association) MaxMessageSize() uint32
MaxMessageSize returns the maximum message size you can send.
func (*Association) OpenStream ¶
func (a *Association) OpenStream( streamIdentifier uint16, defaultPayloadType PayloadProtocolIdentifier, ) (*Stream, error)
OpenStream opens a stream.
func (*Association) RWND ¶ added in v1.8.7
func (a *Association) RWND() uint32
RWND returns the association's current receiver window (rwnd).
func (*Association) SRTT ¶ added in v1.8.7
func (a *Association) SRTT() float64
SRTT returns the latest smoothed round-trip time (srrt).
func (*Association) SetMaxMessageSize ¶ added in v1.7.10
func (a *Association) SetMaxMessageSize(maxMsgSize uint32)
SetMaxMessageSize sets the maximum message size you can send.
func (*Association) Shutdown ¶ added in v1.7.12
func (a *Association) Shutdown(ctx context.Context) error
Shutdown initiates the shutdown sequence. The method blocks until the shutdown sequence is completed and the connection is closed, or until the passed context is done, in which case the context's error is returned.
type AssociationOption ¶ added in v1.9.3
type AssociationOption interface {
ServerOption
ClientOption
}
AssociationOption applies to both client and server.
func WithBlockWrite ¶ added in v1.9.3
func WithBlockWrite(b bool) AssociationOption
WithBlockWrite sets whether the association should use blocking writes. By default this is false.
func WithCwndCAStep ¶ added in v1.9.3
func WithCwndCAStep(cwndCAStep uint32) AssociationOption
WithCwndCAStep sets the congestion window congestion avoidance step for the association.
func WithEnableZeroChecksum ¶ added in v1.9.3
func WithEnableZeroChecksum(b bool) AssociationOption
WithEnableZeroChecksum sets whether the association should accept zero as a valid checksum. By default this is false.
func WithFastRtxWnd ¶ added in v1.9.3
func WithFastRtxWnd(fastRtxWnd uint32) AssociationOption
WithFastRtxWnd sets the fast retransmission window for the association.
func WithLoggerFactory ¶ added in v1.9.3
func WithLoggerFactory(loggerFactory logging.LoggerFactory) AssociationOption
WithLoggerFactory sets the logger factory for the association.
func WithMTU ¶ added in v1.9.3
func WithMTU(size uint32) AssociationOption
WithMTU sets the MTU size for the association. By default this is 1228.
func WithMaxMessageSize ¶ added in v1.9.3
func WithMaxMessageSize(size uint32) AssociationOption
WithMaxMessageSize sets the maximum message size for the association. By default this is 65536.
func WithMaxReceiveBufferSize ¶ added in v1.9.3
func WithMaxReceiveBufferSize(size uint32) AssociationOption
WithMaxReceiveBufferSize sets the maximum receive buffer size for the association. By default this is 1024 * 1024 = 1048576.
func WithMinCwnd ¶ added in v1.9.3
func WithMinCwnd(minCwnd uint32) AssociationOption
WithMinCwnd sets the minimum congestion window for the association.
func WithName ¶ added in v1.9.3
func WithName(name string) AssociationOption
WithName sets the name of the association.
func WithNetConn ¶ added in v1.9.3
func WithNetConn(conn net.Conn) AssociationOption
WithNetConn sets the net.Conn used by the association.
func WithRACKOptions ¶ added in v1.9.3
func WithRACKOptions(opts ...AssociationRACKOption) AssociationOption
WithRACKOptions configures optional RACK settings using the above options. This also creates the new windowedMin slice used for tracking the minRTT.
func WithRTOMax ¶ added in v1.9.3
func WithRTOMax(rtoMax float64) AssociationOption
WithRTOMax sets the max retransmission timeout in ms for the association.
func WithSNAP ¶ added in v1.9.4
func WithSNAP(localSctpInit []byte, remoteSctpInit []byte) AssociationOption
WithSNAP enables SNAP, https://datatracker.ietf.org/doc/draft-hancke-tsvwg-snap/.
type AssociationRACKOption ¶ added in v1.9.3
type AssociationRACKOption func(*rackSettings) error
AssociationRACKOption represents a function that can be used to configure an Association's RACK options.
func WithRackMinRTTWnd ¶ added in v1.9.3
func WithRackMinRTTWnd(rackMinRTTWnd time.Duration) AssociationRACKOption
WithRackMinRTTWnd sets the length of the local minimum window used to determine the minRTT. By default this is 30 seconds.
func WithRackReoWndFloor ¶ added in v1.9.3
func WithRackReoWndFloor(rackReoWndFloor time.Duration) AssociationRACKOption
WithRackReoWndFloor sets the RACK reordering window floor for the association. By default this is 0.
func WithRackWCDelAck ¶ added in v1.9.3
func WithRackWCDelAck(rackWCDelAck time.Duration) AssociationRACKOption
WithRackWCDelAck sets the receiver worst-case delayed-ACK for PTO when only 1 packet is in flight. By default this is 200 ms.
type ClientOption ¶ added in v1.9.3
type ClientOption interface {
// contains filtered or unexported methods
}
ClientOption configures a Client.
type Config ¶ added in v1.5.0
type Config struct {
LoggerFactory logging.LoggerFactory
Name string
NetConn net.Conn
BlockWrite bool
EnableZeroChecksum bool
MTU uint32
// congestion control configuration
MaxReceiveBufferSize uint32
MaxMessageSize uint32
// RTOMax is the maximum retransmission timeout in milliseconds
RTOMax float64
// Minimum congestion window
MinCwnd uint32
// Send window for fast retransmit
FastRtxWnd uint32
// Step of congestion window increase at Congestion Avoidance
CwndCAStep uint32
// contains filtered or unexported fields
}
Config collects the arguments to createAssociation construction into a single structure.
type PayloadProtocolIdentifier ¶
type PayloadProtocolIdentifier uint32
PayloadProtocolIdentifier is an enum for DataChannel payload types.
const ( PayloadTypeUnknown PayloadProtocolIdentifier = 0 PayloadTypeWebRTCDCEP PayloadProtocolIdentifier = 50 PayloadTypeWebRTCString PayloadProtocolIdentifier = 51 PayloadTypeWebRTCBinary PayloadProtocolIdentifier = 53 PayloadTypeWebRTCStringEmpty PayloadProtocolIdentifier = 56 PayloadTypeWebRTCBinaryEmpty PayloadProtocolIdentifier = 57 )
PayloadProtocolIdentifier enums https://www.iana.org/assignments/sctp-parameters/sctp-parameters.xhtml#sctp-parameters-25
func (PayloadProtocolIdentifier) String ¶
func (p PayloadProtocolIdentifier) String() string
type ServerOption ¶ added in v1.9.3
type ServerOption interface {
// contains filtered or unexported methods
}
ServerOption configures a Server.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream represents an SCTP stream.
func (*Stream) BufferedAmount ¶ added in v1.5.0
BufferedAmount returns the number of bytes of data currently queued to be sent over this stream.
func (*Stream) BufferedAmountLowThreshold ¶ added in v1.5.0
BufferedAmountLowThreshold returns the number of bytes of buffered outgoing data that is considered "low." Defaults to 0.
func (*Stream) Close ¶
Close closes the write-direction of the stream. Future calls to Write are not permitted after calling Close.
func (*Stream) OnBufferedAmountLow ¶ added in v1.5.0
func (s *Stream) OnBufferedAmountLow(f func())
OnBufferedAmountLow sets the callback handler which would be called when the number of bytes of outgoing data buffered is lower than the threshold.
func (*Stream) Read ¶
Read reads a packet of len(p) bytes, dropping the Payload Protocol Identifier. Returns EOF when the stream is reset or an error if the stream is closed otherwise.
func (*Stream) ReadSCTP ¶
func (s *Stream) ReadSCTP(payload []byte) (int, PayloadProtocolIdentifier, error)
ReadSCTP reads a packet of len(payload) bytes and returns the associated Payload Protocol Identifier. Returns EOF when the stream is reset or an error if the stream is closed otherwise.
func (*Stream) SetBufferedAmountLowThreshold ¶ added in v1.5.0
SetBufferedAmountLowThreshold is used to update the threshold. See BufferedAmountLowThreshold().
func (*Stream) SetDeadline ¶ added in v1.8.35
SetDeadline sets the read and write deadlines in an identical way to net.Conn.
func (*Stream) SetDefaultPayloadType ¶
func (s *Stream) SetDefaultPayloadType(defaultPayloadType PayloadProtocolIdentifier)
SetDefaultPayloadType sets the default payload type used by Write.
func (*Stream) SetReadDeadline ¶ added in v1.8.4
SetReadDeadline sets the read deadline in an identical way to net.Conn.
func (*Stream) SetReliabilityParams ¶
SetReliabilityParams sets reliability parameters for this stream.
func (*Stream) SetWriteDeadline ¶ added in v1.8.35
SetWriteDeadline sets the write deadline in an identical way to net.Conn, it will only work for blocking writes.
func (*Stream) State ¶ added in v1.8.3
func (s *Stream) State() StreamState
State return the stream state.
func (*Stream) StreamIdentifier ¶
StreamIdentifier returns the Stream identifier associated to the stream.
type StreamState ¶ added in v1.8.3
type StreamState int
StreamState is an enum for SCTP Stream state field This field identifies the state of stream.
const ( StreamStateOpen StreamState = iota // Stream object starts with StreamStateOpen StreamStateClosing // Outgoing stream is being reset StreamStateClosed // Stream has been closed )
StreamState enums.
func (StreamState) String ¶ added in v1.8.3
func (ss StreamState) String() string
Source Files
¶
- ack_timer.go
- association.go
- association_options.go
- association_rack_options.go
- association_stats.go
- chunk.go
- chunk_abort.go
- chunk_cookie_ack.go
- chunk_cookie_echo.go
- chunk_error.go
- chunk_forward_tsn.go
- chunk_heartbeat.go
- chunk_heartbeat_ack.go
- chunk_init.go
- chunk_init_ack.go
- chunk_init_common.go
- chunk_payload_data.go
- chunk_reconfig.go
- chunk_selective_ack.go
- chunk_shutdown.go
- chunk_shutdown_ack.go
- chunk_shutdown_complete.go
- chunkheader.go
- chunktype.go
- control_queue.go
- error_cause.go
- error_cause_header.go
- error_cause_invalid_mandatory_parameter.go
- error_cause_protocol_violation.go
- error_cause_unrecognized_chunk_type.go
- error_cause_user_initiated_abort.go
- errors.go
- packet.go
- param.go
- param_chunk_list.go
- param_ecn_capable.go
- param_forward_tsn_supported.go
- param_heartbeat_info.go
- param_outgoing_reset_request.go
- param_random.go
- param_reconfig_response.go
- param_requested_hmac_algorithm.go
- param_state_cookie.go
- param_supported_extensions.go
- param_zero_checksum.go
- paramheader.go
- paramtype.go
- payload_queue.go
- pending_queue.go
- queue.go
- reassembly_queue.go
- receive_payload_queue.go
- rtx_timer.go
- sctp.go
- stream.go
- util.go
- windowedmin.go
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
ping-pong/ping
command
Package main implements a simple ping-pong example
|
Package main implements a simple ping-pong example |
|
ping-pong/pong
command
Package main implements a simple ping-pong example
|
Package main implements a simple ping-pong example |