Golang library for Radius

Related tags

Network goradius


Build Status GoDoc


goradius package implements basic Radius client capabilities, allowing Go code to authenticate against a Radius server. It is based on https://github.com/btimby/py-radius python package


To install this package simply:

go get github.com/kirves/goradius


Before testing goradius fill the necessary data in the goradius_test.go file (server url, secret, username and password to test the client).

After that, simply run:

go test github.com/kirves/goradius


To authenticate a user simply create a new AuthenticatorT object using server information and the secret associated to your client

auth := goradius.Authenticator(server_url, server_port, secret)

And try to authenticate a user:

ok, err := auth.Authenticate(username, password, nasId)
if err != nil {
if ok {
	// user successfully authenticated


goradius is released under the MIT license. See LICENSE.

  • Timeout for Authenticate is incorrect because the value is multiplied twice

    Timeout for Authenticate is incorrect because the value is multiplied twice

    On line 55 https://github.com/kirves/goradius/blob/master/goradius.go#L55 a.timeout is multipled by time.second ==> conn, err := net.DialTimeout("udp", url, a.timeout*time.Second)

    but the timeout in seconds was already multiplied by time.second on both line 42 and 48. https://github.com/kirves/goradius/blob/master/goradius.go#L42 https://github.com/kirves/goradius/blob/master/goradius.go#L48

    This results in error: "dial udp: i/o timeout"

    Solution: remove * time.Second from line 55

    opened by dv-user1 1
  • fix testing the return packet

    fix testing the return packet

    Thanks for creating this port.

    I fixed your commented code to actually work. The bug was that it didn't truncate the received packet at the specified length.

    opened by giganteous 1
  • Fix dial timeout case.

    Fix dial timeout case.

    The prior version of goradius used timeout seconds, while the 2017-May-2 version uses time.Duration. The timeout multiplies that by time.Seconds duration, causing excessively long timeouts.

    Fix the timeout case to remove the * time.Second. Fix the error message to use the time.Duration String() representation.

    Added a unit test for Dial timeout.

    opened by pythonistic 0
  • Removed static timeout settings in favor of configurable timeout

    Removed static timeout settings in favor of configurable timeout

    Made the timeout configurable. Found that if a server is slow on the initial connection and slow on returning a result, the static responseTimeout could easily be hit causing the function to return a timeout error instead of waiting for a response.

    opened by nickryand 0
  • Fix timeouts on RADIUS server response

    Fix timeouts on RADIUS server response

    • Fix retry loop for requests to server
    • Avoid memory leak having non terminating go routine if server doesn't respond. Previously there was an unbuffered communication channel which would block the go routine if there's no receiver (i.e. the receiver has terminated). Solution: use buffered channels with capacity "1"
    • Renamed var for request packet
    opened by reators 0
  • Added nasId attribute

    Added nasId attribute

    Hello Alessando, I needed the nasId attribute to have grouped RADIUS access to a Windows-AD. To preserve backward compatibility the attribute won't be sent if the corresponding string is empty. Please consider to incorporate this pull request.

    opened by reators 0
  • more ideomatic implementation, IMHO

    more ideomatic implementation, IMHO

    Hey Alessandro,

    I got distracted by other tasks, coming back very late with this pull request we discussed earlier (sometime in July!). However, I'm not sure you are going to like it, as it changes quite a bit of the code:

    • rename package-name from 'goradius' -> 'radius'
    • initialization now with radius.New(server, port, pass)
    • AuthenticatorT is now named Authenticator
    • Authenticator struct exposes timeout and retries-attributes, so they can be changed
    • retry is actually implemented now
    • parsing the response correctly had been fixed in the meantime by some other contributor, but I have a different fix (which is shorter, I believe)
    • some things are more go-ideomatic, I think, but that is rather a matter of taste

    Maybe you want to give it a try, or just stick with your (working!) version. As I said, for me it is more a matter of honoring your efforts by sharing my implementation.

    Cheers, Özgür

    opened by oec 0
Alessandro Frossi
Alessandro Frossi
A library for the MIGP (Might I Get Pwned) protocolA library for the MIGP (Might I Get Pwned) protocol

MIGP library This contains a library for the MIGP (Might I Get Pwned) protocol. MIGP can be used to build privacy-preserving compromised credential ch

Cloudflare 23 Dec 3, 2022
Gmqtt is a flexible, high-performance MQTT broker library that fully implements the MQTT protocol V3.1.1 and V5 in golang

中文文档 Gmqtt News: MQTT V5 is now supported. But due to those new features in v5, there area lots of breaking changes. If you have any migration problem

null 817 Jan 5, 2023
An SNMP library written in GoLang.

gosnmp GoSNMP is an SNMP client library fully written in Go. It provides Get, GetNext, GetBulk, Walk, BulkWalk, Set and Traps. It supports IPv4 and IP

Go SNMP 929 Jan 7, 2023
A Crypto-Secure, Production-Grade Reliable-UDP Library for golang with FEC

Introduction kcp-go is a Production-Grade Reliable-UDP library for golang. This library intents to provide a smooth, resilient, ordered, error-checked

xtaci 3.5k Dec 28, 2022
Simple mDNS client/server library in Golang

mdns Simple mDNS client/server library in Golang. mDNS or Multicast DNS can be used to discover services on the local network without the use of an au

HashiCorp 932 Jan 4, 2023
Simple, fast and scalable golang rpc library for high load

gorpc Simple, fast and scalable golang RPC library for high load and microservices. Gorpc provides the following features useful for highly loaded pro

Aliaksandr Valialkin 667 Dec 19, 2022
Golang connection multiplexing library

Yamux Yamux (Yet another Multiplexer) is a multiplexing library for Golang. It relies on an underlying connection to provide reliability and ordering,

HashiCorp 1.9k Jan 7, 2023
Go/Golang client library to interact with the Stein API

go-stein This Go / Golang client helps you interact with the Stein API. Stein is a suite of programs to help you turn any Google Sheet to a database.

Nasrul Faizin 4 Aug 23, 2022
A golang library about socks5, supports all socks5 commands. That Provides server and client and easy to use. Compatible with socks4 and socks4a.

socks5 This is a Golang implementation of the Socks5 protocol library. To see in this SOCKS Protocol Version 5. This library is also compatible with S

chenhao zhang 40 Nov 22, 2022
zMemif is a native golang based library for memif to interworking with dpdk.

zMemif zMemif is a native golang based library for memif to interworking with dpdk. it can simply provide 20Mpps recv and 10Mpps xmit capability. The

Mie~~~ 36 Dec 27, 2022
Ping library for Golang with multi-host support

pingo Fast and lightweight ping library for Golang with multi-host support. Features ICMP sockets: UDP port 0 means "let the kernel pick a free number

Arseny Mitin 36 Nov 9, 2022
A lightweight and simplistic Tor library for golang

gotor A lightweight and simplistic Tor library for golang go get github.com/ripmeep/gotor import "github.com/ripmeep/gotor" Usage t := tor.TorConnecti

ripmeep 2 Jul 2, 2022
Client library with golang for accessing Harbor API.

go-client Client library with golang for accessing Harbor API. Client Types There are 3 swagger files in this repo. api/ v2.0/ legacy_swag

Harbor 17 Nov 13, 2022
Golang TFTP library.

A Cross-Platform TFTP Server with Configurable Request Handlers and fs.FS support The TFTP Server is highly flexible for all platforms due to the Go f

G DATA CyberDefense AG 4 Dec 1, 2022
Reliable, thin UDP library for Golang targetting games.

⚠️ Do not use this. There's a lot to be worked on here and it's still not comple

sailormoon 2 Dec 27, 2021
Simple and modern beanstalkd library for Golang

go-jackd package main import "github.com/getjackd/go-jackd" func main() {

null 7 Sep 27, 2022
Go-aspell - GNU Aspell spell checking library bindings for golang

Aspell library bindings for Go GNU Aspell is a spell checking tool written in C/

Vladimir Sibirov 43 Nov 14, 2022
P2PDistributedHashTable - A golang Kademlia/Bittorrent DHT library that implements BEP5

This is a golang Kademlia/Bittorrent DHT library that implements BEP 5. It's typ

Suhas Aggarwal 2 Apr 10, 2022
A yaml data-driven testing format together with golang testing library

Specified Yaml data-driven testing Specified is a yaml data format for data-driven testing. This enforces separation between feature being tested the

Design it, Run it 0 Jan 9, 2022