• Stars
    star
    244
  • Rank 165,885 (Top 4 %)
  • Language
    Go
  • License
    Other
  • Created about 11 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Diameter stack and Base Protocol (RFC 6733) for the Go programming language

Diameter Base Protocol

Go Report Card Test Status Go Reference Latest

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

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.

See the API documentation at https://pkg.go.dev/github.com/fiorix/go-diameter/v4

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:

export GO111MODULE=on
go run github.com/fiorix/go-diameter/v4/examples/server
go run github.com/fiorix/go-diameter/v4/examples/client -hello

Without modules, use standard procedure:

go get github.com/fiorix/go-diameter/examples/...
go run github.com/fiorix/go-diameter/examples/server
go run github.com/fiorix/go-diameter/examples/client -hello

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.

In the examples directory, the server has a pprof (http server) that allows the go pprof tool to profile the server in real time. The client can perform benchmarks using the -bench command line flag.

For better performance, avoid logging diameter messages. Although logging is very useful for debugging purposes, it kills performance due to a number of conversions to make messages look pretty. If you run benchmarks on the example server, make sure to use the -s (silent) command line switch.

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

In case you want to add new AVPs, please add them to diam/dict/testdata xml files. Then regenerate the go models using ./autogen.sh you will find at diam folder. This will modify files at diam/dict to include your changes.

Before submitting PR, please run make test to test your changes. Or do it manually:

	go test ./...

You also have the option to run the test using a Linux VM through Docker (this is not mandatory). To do so, run make test_docker. Runing test on Linux can be useful in case you add sctp tests. Note you will need to install docker and docker-compose.

More Repositories

1

freegeoip

IP geolocation web server
Go
4,931
star
2

wsdl2go

Command line tool to generate Go code from WSDL for SOAP XML services
Go
449
star
3

go-smpp

SMPP 3.4 Protocol for the Go programming language
Go
218
star
4

protoc-gen-cobra

Cobra command line tool generator for gRPC clients
Go
189
star
5

go-daemon

Utility to "daemonize" Go programs
C
174
star
6

go-eventsocket

FreeSWITCH Event Socket library for the Go programming language.
Go
125
star
7

cat-o-licious

Cat game written in Go
Go
104
star
8

eventsocket

Twisted protocol for the FreeSWITCH's Event Socket
Python
54
star
9

go-web

Utilities for http servers written in Go
Go
52
star
10

sms-api-server

HTTP API to send SMS via SMPP
Go
47
star
11

go-redis

Redis client library for Go
Go
45
star
12

txtraceroute

An asynchronous, pure python, traceroute with geolocation information
Python
44
star
13

twisted-twitter-stream

Twitter Stream API for Twisted
Python
43
star
14

jsonschema2go

Code generator for JSON schema
Go
38
star
15

ffmpeg-arm

Docker image with ffmpeg for ARM (Raspberry Pi)
37
star
16

nitgen-bsp

Python extension for Nitgen fingerprint recognition devices
C
22
star
17

mustash

recognize people's face and put a mustache on it
Python
15
star
18

defacer

meow
Go
12
star
19

go-swagger-ui

Go HTTP handler for serving swagger-ui
Go
10
star
20

niosted

Experimental reactor on top of Java NIO
Python
8
star
21

gocp

Go Concurrency Primitives
Go
7
star
22

dotfiles

my set of configuration files
Shell
5
star
23

go-talks

A collection of my Go talks
Go
5
star
24

txdbapi

Experimental ORM for Twisted based on Twistar
Python
4
star
25

pyqrcode

QRcode encoder and decoder for python
Java
4
star
26

go-listener

TCP listener on roids
Go
3
star
27

crosstool-ng-arm

Docker image with crosstool-ng for ARM (Raspberry Pi)
Shell
3
star
28

talkinator

a talking akinator
Python
3
star
29

pyascii85

Ascii85 encoder and decoder for python
C
3
star
30

linvpn

Secure socket layer for pppd (legacy)
C
2
star
31

b3-geoip-plugin

IP Geolocation plugin for the Big Brother Bot
Python
2
star
32

fiorix.github.com

HTML
2
star
33

pbserver

pbcopy and pbpaste over the web
Python
1
star