open-vault/vendor/layeh.com/radius
Jeff Mitchell 6c9dd6ed6f Try out a radius fix (#3461) 2017-10-16 16:26:34 -04:00
..
rfc2865 Try out a radius fix (#3461) 2017-10-16 16:26:34 -04:00
LICENSE RADIUS Authentication Backend (#2268) 2017-02-07 16:04:27 -05:00
README.md Bump deps 2017-09-05 18:06:47 -04:00
attribute.go Bump deps 2017-09-05 18:06:47 -04:00
attributes.go Bump deps 2017-09-05 18:06:47 -04:00
client.go Bump deps 2017-09-05 18:06:47 -04:00
code.go Bump deps 2017-09-05 18:06:47 -04:00
doc.go Bump deps 2017-09-05 18:06:47 -04:00
generate.go Bump deps 2017-09-05 18:06:47 -04:00
packet.go Bump deps 2017-09-05 18:06:47 -04:00
server-packet.go Bump deps 2017-09-05 18:06:47 -04:00
server.go Bump deps 2017-09-05 18:06:47 -04:00

README.md

radius GoDoc

a Go (golang) RADIUS client and server implementation

Installation

go get -u layeh.com/radius

Client example

package main

import (
	"context"
	"fmt"

	"layeh.com/radius"
	. "layeh.com/radius/rfc2865"
)

func main() {
	packet := radius.New(radius.CodeAccessRequest, []byte(`secret`))
	UserName_SetString(packet, "tim")
	UserPassword_SetString(packet, "12345")
	response, err := radius.Exchange(context.Background(), packet, "localhost:1812")
	if err != nil {
		panic(err)
	}

	if response.Code == radius.CodeAccessAccept {
		fmt.Println("Accepted")
	} else {
		fmt.Println("Denied")
	}
}

RADIUS Dictionaries

Included in this package is the command line program radius-dict-gen. It can be installed with:

go get -u layeh.com/radius/cmd/radius-dict-gen

This program will generate helper functions and types for reading and manipulating RADIUS attributes in a packet. It is recommended that generated code be used for any RADIUS dictionary you would like to consume.

Included in this repository are sub-packages of generated helpers for commonly used RADIUS attributes, including rfc2865 and rfc2866.

License

MPL 2.0