GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - talkincode/radius: a Go (golang) RADIUS client and server implementation

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

247 Commits
247 Commits

Folders and files

NameName
Last commit message
Last commit date
cmd
cmd
 
 
debug
debug
 
 
dictionary
dictionary
 
 
dictionarygen
dictionarygen
 
 
internal
internal
 
 
rfc2759
rfc2759
 
 
rfc2865
rfc2865
 
 
rfc2866
rfc2866
 
 
rfc2867
rfc2867
 
 
rfc2868
rfc2868
 
 
rfc2869
rfc2869
 
 
rfc3079
rfc3079
 
 
rfc3162
rfc3162
 
 
rfc3576
rfc3576
 
 
rfc3580
rfc3580
 
 
rfc4072
rfc4072
 
 
rfc4372
rfc4372
 
 
rfc4603
rfc4603
 
 
rfc4675
rfc4675
 
 
rfc4679
rfc4679
 
 
rfc4818
rfc4818
 
 
rfc4849
rfc4849
 
 
rfc5090
rfc5090
 
 
rfc5176
rfc5176
 
 
rfc5447
rfc5447
 
 
rfc5580
rfc5580
 
 
rfc5607
rfc5607
 
 
rfc5904
rfc5904
 
 
rfc6519
rfc6519
 
 
rfc6572
rfc6572
 
 
rfc6677
rfc6677
 
 
rfc6911
rfc6911
 
 
rfc7055
rfc7055
 
 
rfc7268
rfc7268
 
 
vendors
vendors
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
attribute.go
attribute.go
 
 
attribute_test.go
attribute_test.go
 
 
attributes.go
attributes.go
 
 
attributes_test.go
attributes_test.go
 
 
client-example_test.go
client-example_test.go
 
 
client.go
client.go
 
 
client_test.go
client_test.go
 
 
code.go
code.go
 
 
doc.go
doc.go
 
 
errors.go
errors.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
helper_test.go
helper_test.go
 
 
packet.go
packet.go
 
 
packet_test.go
packet_test.go
 
 
server-example_test.go
server-example_test.go
 
 
server-packet.go
server-packet.go
 
 
server-packet_test.go
server-packet_test.go
 
 
server.go
server.go
 
 

Repository files navigation

radius

a Go (golang) RADIUS client and server implementation

Go Reference

Installation

go get -u layeh.com/radius

Client example

package main

import (
	"context"
	"log"

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

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

	log.Println("Code:", response.Code)
}

Server example

package main

import (
	"log"

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

func main() {
	handler := func(w radius.ResponseWriter, r *radius.Request) {
		username := rfc2865.UserName_GetString(r.Packet)
		password := rfc2865.UserPassword_GetString(r.Packet)

		var code radius.Code
		if username == "tim" && password == "12345" {
			code = radius.CodeAccessAccept
		} else {
			code = radius.CodeAccessReject
		}
		log.Printf("Writing %v to %v", code, r.RemoteAddr)
		w.Write(r.Response(code))
	}

	server := radius.PacketServer{
		Handler:      radius.HandlerFunc(handler),
		SecretSource: radius.StaticSecretSource([]byte(`secret`)),
	}

	log.Printf("Starting server on :1812")
	if err := server.ListenAndServe(); err != nil {
		log.Fatal(err)
	}
}

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

Given a FreeRADIUS dictionary, the 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

Author

Tim Cooper ([email protected])

About

a Go (golang) RADIUS client and server implementation

godoc.org/layeh.com/radius

Resources

Readme
MPL-2.0 license
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.