Diameter Base Protocol

Package go-diameter is an implementation of the Diameter Base Protocol RFC 6733 and a stack for the Go programming language.

GoDoc

Status

The current implementation is solid and works fine for general purpose clients and servers. It can send and receive messages efficiently as well as build and parse AVPs based on dictionaries.

Build Status

Features

  • Comprehensive XML dictionary format
  • Embedded dictionaries:
  • Human readable AVP representation (for debugging)
  • TLS, IPv4 and IPv6 support for both clients and servers
  • Stack based on net/http for simplicity
  • Ships with sample client, server, snoop agent and benchmark tool
  • State machines for CER/CEA and DWR/DWA for clients and servers
  • TCP and SCTP support. SCTP support relies on kernel SCTP implementation and external github.com/ishidawataru/sctp package and is currently tested and enabled for Go 1.8+ and x86 Linux

Getting started

The easiest way to get started is by trying out the client and server example programs.

With Go 1.11 and newer (preferred), you can start the client and server already:

Without modules, use standard procedure:

Source code is your best friend. Check out other examples and test cases.

Performance

Clients and servers written with the go-diameter package can be quite performant if done well. Besides Go benchmarks, the package ships with a simple benchmark tool to help testing servers and identifying bottlenecks.

go pprof-bench
-s

TLS degrades performance a bit, as well as reflection (Unmarshal). Those are important trade offs you might have to consider.

Besides this, the source code (and sub-packages) have function benchmarks that can help you understand what's fast and isn't. You will see that parsing messages is much slower than writing them, for example. This is because in order to parse messages it makes numerous dictionary lookups for AVP types, to be able to decode them. Encoding messages require less lookups and is generally simpler, thus faster.

Contribute

diam/dict/testdata./autogen.shdiamdiam/dict
make test
make test_dockersctp