Skip to content

A go library implementing the SCTP protocol

License

MIT, BSD-3-Clause licenses found

Licenses found

MIT
LICENSE
BSD-3-Clause
GO_LICENSE
Notifications You must be signed in to change notification settings

georgeyanev/go-sctp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ace93fe · Jan 14, 2025
Dec 1, 2024
Jan 14, 2025
Dec 9, 2024
Oct 29, 2024
Jan 14, 2025
Oct 29, 2024
Sep 20, 2024
Jan 14, 2025
Dec 16, 2024
Dec 17, 2024
Dec 9, 2024
Dec 10, 2024
Dec 10, 2024
Dec 21, 2024
Jan 14, 2025
Dec 22, 2024
Dec 10, 2024
Dec 10, 2024
Jan 14, 2025
Dec 19, 2024
Dec 10, 2024
Jan 14, 2025
Dec 9, 2024
Dec 10, 2024
Dec 9, 2024
Dec 22, 2024
Jan 14, 2025
Jan 14, 2025
Dec 9, 2024
Dec 10, 2024
Jan 14, 2025
Dec 10, 2024
Dec 10, 2024

Repository files navigation

SCTP for Go

Go Tests Go Reference codecov Fork me on GitHub

go-sctp is a Golang package that provides an efficient interface for working with the Stream Control Transmission Protocol (SCTP). SCTP support in the Go ecosystem has been sparse and go-sctp aims to fill this gap. It offers high-level abstractions like SCTPConn, SCTPListener, and SCTPAddr, seamlessly integrating with Go's net package by implementing net.Conn, net.Listener, and net.Addr. Also, it integrates with Go's runtime network poller to provide asynchronous low-level I/O and deadline support.

This library supports SCTP's one-to-one mode and is designed specifically for Linux environments. It mimics most of the TCP functionality implemented in Go's net package, with added support for multihoming, multistreaming and SCTP notifications.

go-sctp interfaces directly with the kernel SCTP module, leveraging system calls provided by Go's unix and syscall packages. This eliminates the need for external SCTP libraries, ensuring a lightweight, efficient, and dependency-free implementation.

Well-structured and comprehensive documentation is prioritized as part of the development process.


Features

  • Support for one-to-one SCTP mode (SOCK_STREAM socket type)
  • Use of non-blocking sockets
  • Integration with go's runtime network poller through os.File
  • Dial, Listen, Accept functionality following Go's TCP implementation logic
  • Basic SCTP read and write through SCTPConn.Read and SCTPConn.Write
  • Enhanced SCTP read and write through SCTPConn.ReadMsg and SCTPConn.WriteMsg
  • Deadline support for read/write/accept operations
  • Multi-streaming support through sctp.SndInfo and sctp.RcvInfo structures
  • Multi-homing support embedded in SCTPAddr
  • SCTP Notifications support
  • Exported socket options (i.e. SCTP_ADAPTATION_LAYER, SCTP_DISABLE_FRAGMENTS)
  • Runtime re-binding support through BindAdd and BindRemove
  • Shutdown and Abort support
  • Most of the TCP tests in Go's net package applied here to SCTP
  • Well documented

For a complete list of features and the history of changes introduced in each version, refer to the CHANGELOG.md.


Getting

go get -u github.com/georgeyanev/go-sctp


Usage

Most functionality mirrors Go's TCP implementation, making it intuitive to use. For example:

Dial:

conn, err := sctp.Dial("sctp4", "127.0.0.1/127.0.0.2:3868")

Listen:

ln, err := sctp.Listen("sctp4", "127.0.0.1/127.0.0.2:3868")

Accept:

conn, err := ln.Accept()

Kernel parameters:

For optimal performance set the kernel parameters net.core.rmem_max and net.core.wmem_max to at least 512KB


Contributing

Contributions are welcome! If you find a bug, have a feature request, or want to contribute code, feel free to open an issue or pull request.

About

A go library implementing the SCTP protocol

Resources

License

MIT, BSD-3-Clause licenses found

Licenses found

MIT
LICENSE
BSD-3-Clause
GO_LICENSE

Stars

Watchers

Forks

Packages

No packages published

Languages