Documentation
¶
Overview ¶
Various helper functions, that are used by RADIUS Client & Server to encode/decode information inside RADIUS packet They are also available to crate users to prepare data before it is packed into RADIUS packet
Index ¶
- func BytesToIPv4String(ipv4 []uint8) (string, error)
- func BytesToIPv6String(ipv6 []uint8) (string, bool)
- func BytesToInteger(integer []uint8) (uint32, bool)
- func BytesToInteger64(integer []uint8) (uint64, bool)
- func BytesToTimestamp(timestamp []uint8) (uint32, bool)
- func DecryptData(data, authenticator, secret *[]uint8) []uint8
- func EncryptData(data, authenticator, secret *[]uint8) []uint8
- func IPv4StringToBytes(ipv4 string) ([]uint8, error)
- func IPv6StringToBytes(ipv6 string) ([]uint8, error)
- func Integer64ToBytes(integer uint64) []uint8
- func IntegerToBytes(integer uint32) []uint8
- func SaltDecryptData(data, authenticator, secret *[]uint8) ([]uint8, error)
- func SaltEncryptData(data, authenticator, salt, secret *[]uint8) []uint8
- func TimestampToBytes(timestamp int64) ([]uint8, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToIPv4String ¶
BytesToIPv4String converts IPv4 bytes into IPv4 string
func BytesToIPv6String ¶
BytesToIPv6String converts IPv6 bytes into IPv6 string Returns value & bool => need to check bool, if true then successful, otherwise not
func BytesToInteger ¶
BytesToInteger converts integer bytes into u32
func BytesToInteger64 ¶
BytesToInteger64 converts integer bytes into u64
func BytesToTimestamp ¶
BytesToTimestamp converts timestamp bytes into int64
Golang has timestamps as int64, however RADIIUS protocol has timestamp('time') as uint32 therefore we need to apply a bit of logic to link these 2 together
func DecryptData ¶
DecryptData decrypts data since RADIUS packet is sent in plain text
Should be used to decrypt value of **User-Password** attribute (but could also be used to decrypt any data)
func EncryptData ¶
EncryptData encrypts data since RADIUS packet is sent in plain text
Should be used to encrypt value of **User-Password** attribute (but could also be used to encrypt any data)
func IPv4StringToBytes ¶
IPv4StringToBytes converts IPv4 Address string into vector of bytes
Should be used for any Attribute of type **ipaddr**, **ipv4addr** & **ipv4prefix** to ensure value is encoded correctly Returns value & error, so need to check if any errors occured before using the value
func IPv6StringToBytes ¶
IPv6StringToBytes converts IPv6 Address string into vector of bytes
Should be used for any Attribute of type **ipv6addr** or **ipv6prefix** to ensure value is encoded correctly Returns value & error, so need to check if any errors occured before using the value
func Integer64ToBytes ¶
Integer64ToBytes converts u64 into vector of bytes
Should be used for any Attribute of type **integer** to ensure value is encoded correctly
func IntegerToBytes ¶
IntegerToBytes converts u32 into vector of bytes
Should be used for any Attribute of type **integer** to ensure value is encoded correctly
func SaltDecryptData ¶
SaltDecryptData decrypts data with salt since RADIUS packet is sent in plain text
Should be used for RADIUS Tunnel-Password Attribute
func SaltEncryptData ¶
SaltEncryptData encrypts data with salt since RADIUS packet is sent in plain text
Should be used for RADIUS Tunnel-Password Attribute
func TimestampToBytes ¶
TimestampToBytes converts timestamp (int64) into vector of bytes
Should be used for any Attribute of type **date** to ensure value is encoded correctly
Golang has timestamps as int64, however RADIIUS protocol expects timestamp('time') as uint32 therefore we need to apply a bit of logic to link these 2 together Returns value & error, so need to check if any errors occured before using the value
Types ¶
This section is empty.