server

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

RADIUS Generic Server implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

func InitialiseServer

func InitialiseServer(dictionary protocol.Dictionary, allowedHosts map[string]string, server string, retries uint16, timeout uint16) Server

InitialiseClient initialises client

Please note that you would need to call **SetPort** manually to initialise Client in full

func (*Server) AllowedHosts

func (server *Server) AllowedHosts() map[string]string

AllowedHosts returns map of allowed hosts (Radius Clients) and their secrets

func (*Server) CreateAttributeByID

func (server *Server) CreateAttributeByID(attrID uint8, value *[]uint8) (protocol.RadiusAttribute, error)

CreateAttributeByID creates RADIUS packet attribute by ID, that is defined in dictionary file

func (*Server) CreateAttributeByName

func (server *Server) CreateAttributeByName(attrName string, value *[]uint8) (protocol.RadiusAttribute, error)

CreateAttributeByName creates RADIUS packet attribute by Name, that is defined in dictionary file

func (*Server) CreateReplyPacket

func (server *Server) CreateReplyPacket(replyCode protocol.TypeCode, attributes []protocol.RadiusAttribute, request *[]uint8, secret string) (protocol.RadiusPacket, error)

CreateReplyPacket creates RADIUS packet with any TypeCode without attributes

func (*Server) InitialisePacketFromBytes

func (server *Server) InitialisePacketFromBytes(request *[]uint8) (protocol.RadiusPacket, error)

InitialisePacketFromBytes initialises RadiusPacket from bytes

Unlike [VerifyRequest](Server::VerifyRequest), on success this function would return RadiusPacket

func (*Server) IsHostAllowed

func (server *Server) IsHostAllowed(remoteHost string) bool

IsHostAllowed checks if host from where Server received RADIUS request is allowed host, meaning RADIUS Server can process such request

func (*Server) Port

func (server *Server) Port(typeCode protocol.TypeCode) (uint16, bool)

Port returns port of RADIUS server, that receives given type of RADIUS message/packet

func (*Server) Retries

func (server *Server) Retries() uint16

Retries returns retries

func (*Server) Secret

func (server *Server) Secret(host string) string

Secret returns secret for a host

func (*Server) Server

func (server *Server) Server() string

Server returns hostname/FQDN of RADIUS Server

func (*Server) SetPort

func (server *Server) SetPort(msgType protocol.RadiusMsgType, port uint16)

**Required/Optional**

SetPort sets remote port, that responsible for specific RADIUS Message Type

func (*Server) Timeout

func (server *Server) Timeout() uint16

Timeout returns timeout

func (*Server) VerifyRequest

func (server *Server) VerifyRequest(packet *[]uint8) error

VerifyRequest verifies that incoming request is valid

Server would try to build RadiusPacket from raw bytes, and if it succeeds then packet is valid, otherwise would return an Error

func (*Server) VerifyRequestAttributes

func (server *Server) VerifyRequestAttributes(packet *[]uint8) error

VerifyRequestAttributes verifies that incoming request's RadiusAttributes values are valid

Server would try to build RadiusPacket from raw bytes, and then it would try to restore RadiusAttribute original value from bytes, based on the attribute data type, see [SupportedAttributeTypes](protocol::dictionary::SupportedAttributeTypes)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL