Documentation
¶
Overview ¶
RADIUS Generic Server implementation
Index ¶
- type Server
- func (server *Server) AllowedHosts() map[string]string
- func (server *Server) CreateAttributeByID(attrID uint8, value *[]uint8) (protocol.RadiusAttribute, error)
- func (server *Server) CreateAttributeByName(attrName string, value *[]uint8) (protocol.RadiusAttribute, error)
- func (server *Server) CreateReplyPacket(replyCode protocol.TypeCode, attributes []protocol.RadiusAttribute, ...) (protocol.RadiusPacket, error)
- func (server *Server) InitialisePacketFromBytes(request *[]uint8) (protocol.RadiusPacket, error)
- func (server *Server) IsHostAllowed(remoteHost string) bool
- func (server *Server) Port(typeCode protocol.TypeCode) (uint16, bool)
- func (server *Server) Retries() uint16
- func (server *Server) Secret(host string) string
- func (server *Server) Server() string
- func (server *Server) SetPort(msgType protocol.RadiusMsgType, port uint16)
- func (server *Server) Timeout() uint16
- func (server *Server) VerifyRequest(packet *[]uint8) error
- func (server *Server) VerifyRequestAttributes(packet *[]uint8) error
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 ¶
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 ¶
IsHostAllowed checks if host from where Server received RADIUS request is allowed host, meaning RADIUS Server can process such request
func (*Server) Port ¶
Port returns port of RADIUS server, that receives given type of RADIUS message/packet
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) VerifyRequest ¶
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 ¶
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)