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
- Host: GitHub
- URL: https://github.com/blind-oracle/go-radius
- Owner: blind-oracle
- License: mpl-2.0
- Created: 2017-05-09T17:08:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-09-21T15:40:59.000Z (about 3 years ago)
- Last Synced: 2024-06-19T00:26:31.054Z (over 1 year ago)
- Topics: coa, dm, go, golang, radius, rfc2865, rfc2866, rfc2869, rfc5176, vsa
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 35
- Watchers: 3
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-radius
[](https://godoc.org/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 ()