An open API service indexing awesome lists of open source software.

https://github.com/blind-oracle/go-radius

Golang RADIUS library with server/client support
https://github.com/blind-oracle/go-radius

coa dm go golang radius rfc2865 rfc2866 rfc2869 rfc5176 vsa

Last synced: about 1 month ago
JSON representation

Golang RADIUS library with server/client support

Awesome Lists containing this project

README

          

# go-radius

[![GoDoc](https://godoc.org/github.com/blind-oracle/go-radius?status.svg)](https://godoc.org/github.com/blind-oracle/go-radius)
[![Go Report Card](https://goreportcard.com/badge/github.com/blind-oracle/go-radius)](https://goreportcard.com/report/github.com/blind-oracle/go-radius)

It's quite heavily rewritten fork of another Go [RADIUS library](https://github.com/layeh/radius)

# Be advised that this library is not actively maintained, the [upstream](https://github.com/layeh/radius) might better suit your needs

Significant changes are:
* Common
* Encoding/Decoding of attribute 26 (Vendor-Specific)
* RFC2866 & RFC2869 (Accounting)

* Server
* Request throttling (maximum requests per second) support
* Supports limiting the number of requests in processing queue
* Multiple RADIUS Secrets based on packet's source IP with a fallback default
* Request/Response packet replication (useful for logging, IDS etc)
* Configurable UDP buffer size

* Client
* Lots of vendor-specific (Cisco, Juniper, Mikrotik) functions and constants
* Support for generating CoA/Disconnect-Message packets

## Installation
go get -u github.com/blind-oracle/go-radius

## Server example
```go
import (
"github.com/blind-oracle/go-radius"
"log"
)

func main() {
handler := func (w radius.ResponseWriter, p *radius.Packet) {
w.AccessAccept()
}

server := radius.Server{
Addr: "0.0.0.0:1812",
Handler: radius.HandlerFunc(handler),
Secret: []byte(o.RADIUSSecret),
Dictionary: radius.Builtin,
}

if err := server.ListenAndServe(); err != nil {
log.Fatal(err)
}
}
```

## Client example
```go
import (
"github.com/blind-oracle/go-radius"
"log"
)

func main() {
client := radius.Client{}
packet := radius.New(radius.CodeAccessRequest, []byte("VerySecret"))
packet.Add("Calling-Station-Id", "NAS-Fake")

reply, err := client.Exchange(packet, "1.2.3.4:1812")
if err != nil {
log.Fatalf(err)
}

switch reply.Code {
case radius.CodeAccessAccept:
log.Println("Accept")
case radius.CodeAccessReject:
log.Println("Reject")
}
}
```

## Authors
* Tim Cooper ()
* Igor Novgorodov ()