kmgRadius

package
v0.0.0-...-05317bf Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2015 License: MIT, MIT Imports: 16 Imported by: 0

README

a golang radius library

This project forks from https://github.com/jessta/radius

document
example
package main

import (
	"github.com/bronze1man/kmg/third/kmgRadius"
	"github.com/bronze1man/kmg/kmgDebug"
	"github.com/bronze1man/kmg/kmgConsole"
)

func main() {
	// run the server in a new thread.
	// 在一个新线程里面一直运行服务器.
	kmgRadius.RunServer(":1812", []byte("sEcReT"), kmgRadius.Handler{
		Auth:       func(username string) (password string, exist bool) {
			if username!="a"{
				return "",false
			}
			return "b",true
		},
		AcctStart:  func(req kmgRadius.AcctRequest) {
			kmgDebug.Println("start",req)
		},
		AcctUpdate: func(req kmgRadius.AcctRequest) {
			kmgDebug.Println("update",req)
		},
		AcctStop:   func(req kmgRadius.AcctRequest) {
			kmgDebug.Println("stop",req)
		},
	})
	// wait for the system sign or ctrl-c to close the process.
	// 等待系统信号或者ctrl-c 关闭进程
	kmgConsole.WaitForExit()
}
implemented
  • a radius server can handle AccessRequest request from strongswan with ikev1-xauth-psk
  • a radius server that can handle AccessRequest request from strongswan with ikev2-eap-psk with ms-chap-v2
  • a radius server can handle AccountingRequest request from strongswan with ikev1-xauth-psk
notice
  • A radius client has not been implement.
  • It works , but it is not stable.
reference
TODO
  • avpEapMessaget.Value error handle.
  • implement radius client side.

Documentation

Index

Constants

View Source
const (
	VendorIdMicrosoft = 311
)

Variables

View Source
var ErrMessageAuthenticatorCheckFail = fmt.Errorf("RADIUS Response-Authenticator verification failed")

Functions

func RunServer

func RunServer(address string, secret []byte, handler Handler) func() error

异步运行服务器, TODO 返回Closer以便可以关闭服务器,所有无法运行的错误panic出来,其他错误丢到kmgLog error里面. 如果不需要Closer可以直接忽略

func RunServerWithPacketHandler

func RunServerWithPacketHandler(address string, secret []byte, handler PacketHandler) func() error

异步运行服务器,返回Closer以便可以关闭服务器,所有无法运行的错误panic出来,其他错误丢到kmgLog error里面.

Types

type AVP

type AVP interface {
	GetType() AVPType
	Encode() (b []byte, err error)
	Copy() AVP

	String() string
	GetValue() interface{}
	ValueAsString() string
}

type AVPType

type AVPType uint8
const (
	//start rfc2865
	AVPTypeUserName                     AVPType = 1
	AVPTypeUserPassword                 AVPType = 2
	AVPTypeCHAPPassword                 AVPType = 3
	AVPTypeNASIPAddress                 AVPType = 4
	AVPTypeNASPort                      AVPType = 5
	AVPTypeServiceType                  AVPType = 6
	AVPTypeFramedProtocol               AVPType = 7
	AVPTypeFramedIPAddress              AVPType = 8  //8
	AVPTypeFramedIPNetmask              AVPType = 9  //9
	AVPTypeFramedRouting                AVPType = 10 //10
	AVPTypeFilterId                     AVPType = 11 //11
	AVPTypeFramedMTU                    AVPType = 12 //12
	AVPTypeFramedCompression            AVPType = 13 //13
	AVPTypeLoginIPHost                  AVPType = 14 //14
	AVPTypeLoginService                 AVPType = 15 //15
	AVPTypeLoginTCPPort                 AVPType = 16 //16
	AVPTypeReplyMessage                 AVPType = 18 //18
	AVPTypeCallbackNumber               AVPType = 19 //19
	AVPTypeCallbackId                   AVPType = 20 //20
	AVPTypeFramedRoute                  AVPType = 22 //22
	AVPTypeFramedIPXNetwork             AVPType = 23 //23
	AVPTypeState                        AVPType = 24 //24
	AVPTypeClass                        AVPType = 25 //25
	AVPTypeVendorSpecific               AVPType = 26
	AVPTypeSessionTimeout               AVPType = 27
	AVPTypeIdleTimeout                  AVPType = 28
	AVPTypeTerminationAction            AVPType = 29
	AVPTypeCalledStationId              AVPType = 30
	AVPTypeCallingStationId             AVPType = 31
	AVPTypeNASIdentifier                AVPType = 32
	AVPTypeProxyState                   AVPType = 33
	AVPTypeLoginLATService              AVPType = 34
	AVPTypeLoginLATNode                 AVPType = 35
	AVPTypeLoginLATGroup                AVPType = 36
	AVPTypeFramedAppleTalkLink          AVPType = 37
	AVPTypeFramedAppleTalkNetwork       AVPType = 38
	AVPTypeFramedAppleTalkZone          AVPType = 39
	AVPTypeAcctStatusType               AVPType = 40
	AVPTypeAcctDelayTime                AVPType = 41
	AVPTypeAcctInputOctets              AVPType = 42
	AVPTypeAcctOutputOctets             AVPType = 43
	AVPTypeAcctSessionId                AVPType = 44
	AVPTypeAcctAuthentic                AVPType = 45
	AVPTypeAcctSessionTime              AVPType = 46
	AVPTypeAcctInputPackets             AVPType = 47
	AVPTypeAcctOutputPackets            AVPType = 48
	AVPTypeAcctTerminateCause           AVPType = 49
	AVPTypeAcctMultiSessionId           AVPType = 50
	AVPTypeAcctLinkCount                AVPType = 51
	AVPTypeAcctInputGigawords           AVPType = 52 //52
	AVPTypeAcctOutputGigawords          AVPType = 53
	AVPTypeUnassigned1                  AVPType = 54
	AVPTypeEventTimestamp               AVPType = 55
	AVPTypeEgressVLANID                 AVPType = 56
	AVPTypeIngressFilters               AVPType = 57
	AVPTypeEgressVLANName               AVPType = 58
	AVPTypeUserPriorityTable            AVPType = 59 //59
	AVPTypeCHAPChallenge                AVPType = 60
	AVPTypeNASPortType                  AVPType = 61
	AVPTypePortLimit                    AVPType = 62
	AVPTypeLoginLATPort                 AVPType = 63 //end rfc2865 rfc 2866
	AVPTypeTunnelType                   AVPType = 64 //64
	AVPTypeTunnelMediumType             AVPType = 65
	AVPTypeTunnelClientEndpoint         AVPType = 66
	AVPTypeTunnelServerEndpoint         AVPType = 67
	AVPTypeAcctTunnelConnection         AVPType = 68
	AVPTypeTunnelPassword               AVPType = 69
	AVPTypeARAPPassword                 AVPType = 70
	AVPTypeARAPFeatures                 AVPType = 71
	AVPTypeARAPZoneAccess               AVPType = 72
	AVPTypeARAPSecurity                 AVPType = 73
	AVPTypeARAPSecurityData             AVPType = 74
	AVPTypePasswordRetry                AVPType = 75
	AVPTypePrompt                       AVPType = 76
	AVPTypeConnectInfo                  AVPType = 77
	AVPTypeConfigurationToken           AVPType = 78
	AVPTypeEAPMessage                   AVPType = 79
	AVPTypeMessageAuthenticator         AVPType = 80
	AVPTypeTunnelPrivateGroupID         AVPType = 81
	AVPTypeTunnelAssignmentID           AVPType = 82
	AVPTypeTunnelPreference             AVPType = 83
	AVPTypeARAPChallengeResponse        AVPType = 84
	AVPTypeAcctInterimInterval          AVPType = 85
	AVPTypeAcctTunnelPacketsLost        AVPType = 86
	AVPTypeNASPortId                    AVPType = 87
	AVPTypeFramedPool                   AVPType = 88
	AVPTypeCUI                          AVPType = 89
	AVPTypeTunnelClientAuthID           AVPType = 90
	AVPTypeTunnelServerAuthID           AVPType = 91
	AVPTypeNASFilterRule                AVPType = 92
	AVPTypeUnassigned                   AVPType = 93
	AVPTypeOriginatingLineInfo          AVPType = 94
	AVPTypeNASIPv6Address               AVPType = 95
	AVPTypeFramedInterfaceId            AVPType = 96
	AVPTypeFramedIPv6Prefix             AVPType = 97
	AVPTypeLoginIPv6Host                AVPType = 98
	AVPTypeFramedIPv6Route              AVPType = 99
	AVPTypeFramedIPv6Pool               AVPType = 100
	AVPTypeErrorCause                   AVPType = 101
	AVPTypeEAPKeyName                   AVPType = 102
	AVPTypeDigestResponse               AVPType = 103
	AVPTypeDigestRealm                  AVPType = 104
	AVPTypeDigestNonce                  AVPType = 105
	AVPTypeDigestResponseAuth           AVPType = 106
	AVPTypeDigestNextnonce              AVPType = 107
	AVPTypeDigestMethod                 AVPType = 108
	AVPTypeDigestURI                    AVPType = 109
	AVPTypeDigestQop                    AVPType = 110
	AVPTypeDigestAlgorithm              AVPType = 111
	AVPTypeDigestEntityBodyHash         AVPType = 112
	AVPTypeDigestCNonce                 AVPType = 113
	AVPTypeDigestNonceCount             AVPType = 114
	AVPTypeDigestUsername               AVPType = 115
	AVPTypeDigestOpaque                 AVPType = 116
	AVPTypeDigestAuthParam              AVPType = 117
	AVPTypeDigestAKAAuts                AVPType = 118
	AVPTypeDigestDomain                 AVPType = 119
	AVPTypeDigestStale                  AVPType = 120
	AVPTypeDigestHA1                    AVPType = 121
	AVPTypeSIPAOR                       AVPType = 122
	AVPTypeDelegatedIPv6Prefix          AVPType = 123
	AVPTypeMIP6FeatureVector            AVPType = 124
	AVPTypeMIP6HomeLinkPrefix           AVPType = 125
	AVPTypeOperatorName                 AVPType = 126
	AVPTypeLocationInformation          AVPType = 127
	AVPTypeLocationData                 AVPType = 128
	AVPTypeBasicLocationPolicyRules     AVPType = 129
	AVPTypeExtendedLocationPolicyRules  AVPType = 130
	AVPTypeLocationCapable              AVPType = 131
	AVPTypeRequestedLocationInfo        AVPType = 132
	AVPTypeFramedManagementProtocol     AVPType = 133
	AVPTypeManagementTransportProtectio AVPType = 134
	AVPTypeManagementPolicyId           AVPType = 135
	AVPTypeManagementPrivilegeLevel     AVPType = 136
	AVPTypePKMSSCert                    AVPType = 137
	AVPTypePKMCACert                    AVPType = 138
	AVPTypePKMConfigSettings            AVPType = 139
	AVPTypePKMCryptosuiteList           AVPType = 140
	AVPTypePKMSAID                      AVPType = 141
	AVPTypePKMSADescriptor              AVPType = 142
	AVPTypePKMAuthKey                   AVPType = 143
	AVPTypeDSLiteTunnelName             AVPType = 144
	AVPTypeMobileNodeIdentifier         AVPType = 145
	AVPTypeServiceSelection             AVPType = 146
	AVPTypePMIP6HomeLMAIPv6Address      AVPType = 147
	AVPTypePMIP6VisitedLMAIPv6Address   AVPType = 148
	AVPTypePMIP6HomeLMAIPv4Address      AVPType = 149
	AVPTypePMIP6VisitedLMAIPv4Address   AVPType = 150
	AVPTypePMIP6HomeHNPrefix            AVPType = 151
	AVPTypePMIP6VisitedHNPrefix         AVPType = 152
	AVPTypePMIP6HomeInterfaceID         AVPType = 153
	AVPTypePMIP6VisitedInterfaceID      AVPType = 154
	AVPTypePMIP6HomeIPv4HoA             AVPType = 155
	AVPTypePMIP6VisitedIPv4HoA          AVPType = 156
	AVPTypePMIP6HomeDHCP4ServerAddress  AVPType = 157
	AVPTypePMIP6VisitedDHCP4ServerAddre AVPType = 158
	AVPTypePMIP6HomeDHCP6ServerAddress  AVPType = 159
	AVPTypePMIP6VisitedDHCP6ServerAddre AVPType = 160
	AVPTypeUnassignedStart              AVPType = 161
	AVPTypeUnassignedEnd                AVPType = 191
	AVPTypeExperimentalStart            AVPType = 192
	AVPTypeExperimentalEnd              AVPType = 223
	AVPTypeImplementationSpecificStart  AVPType = 224
	AVPTypeImplementationSpecificEnd    AVPType = 240
	AVPTypeReservedStart                AVPType = 241
	AVPTypeReservedEnd                  AVPType = 254
)

func (AVPType) String

func (a AVPType) String() string

type AcctRequest

type AcctRequest struct {
	SessionId   string //连接id
	Username    string
	SessionTime uint32 //连接时间
	InputBytes  uint64 //流入字节
	OutputBytes uint64 //流出字节
	NasPort     uint32
}

type AcctStatusTypeEnum

type AcctStatusTypeEnum uint32
const (
	AcctStatusTypeEnumStart         AcctStatusTypeEnum = 1
	AcctStatusTypeEnumStop          AcctStatusTypeEnum = 2
	AcctStatusTypeEnumInterimUpdate AcctStatusTypeEnum = 3
	AcctStatusTypeEnumAccountingOn  AcctStatusTypeEnum = 7
	AcctStatusTypeEnumAccountingOff AcctStatusTypeEnum = 8
)

func (AcctStatusTypeEnum) String

func (e AcctStatusTypeEnum) String() string

type AcctTerminateCauseEnum

type AcctTerminateCauseEnum uint32
const (
	AcctTerminateCauseEnumUserRequest AcctTerminateCauseEnum = 1
	AcctTerminateCauseEnumLostCarrier AcctTerminateCauseEnum = 2
	AcctTerminateCauseEnumLostService AcctTerminateCauseEnum = 3
	AcctTerminateCauseEnumIdleTimeout AcctTerminateCauseEnum = 4
)

TODO finish it

func (AcctTerminateCauseEnum) String

func (e AcctTerminateCauseEnum) String() string

type BinaryAVP

type BinaryAVP struct {
	Type  AVPType
	Value []byte
}

func (*BinaryAVP) Copy

func (a *BinaryAVP) Copy() AVP

func (*BinaryAVP) Encode

func (a *BinaryAVP) Encode() (b []byte, err error)

func (*BinaryAVP) GetType

func (a *BinaryAVP) GetType() AVPType

func (*BinaryAVP) GetValue

func (a *BinaryAVP) GetValue() interface{}

func (*BinaryAVP) String

func (a *BinaryAVP) String() string

func (*BinaryAVP) ValueAsString

func (a *BinaryAVP) ValueAsString() string

type BinaryVSA

type BinaryVSA struct {
	Type  VendorType
	Value []byte
}

func (*BinaryVSA) Encode

func (a *BinaryVSA) Encode() (b []byte, err error)

func (*BinaryVSA) GetType

func (a *BinaryVSA) GetType() VendorType

func (*BinaryVSA) GetValue

func (a *BinaryVSA) GetValue() interface{}

func (*BinaryVSA) String

func (a *BinaryVSA) String() string

type Code

type Code uint8
const (
	CodeAccessRequest      Code = 1
	CodeAccessAccept       Code = 2
	CodeAccessReject       Code = 3
	CodeAccountingRequest  Code = 4
	CodeAccountingResponse Code = 5
	CodeAccessChallenge    Code = 11
	CodeStatusServer       Code = 12 //(experimental)
	CodeStatusClient       Code = 13 //(experimental)
	CodeReserved           Code = 255
)

func (Code) String

func (p Code) String() string

type EapAVP

type EapAVP struct {
	Value eap.Packet
}

func (*EapAVP) Copy

func (a *EapAVP) Copy() AVP

TODO real copy

func (*EapAVP) Encode

func (a *EapAVP) Encode() (b []byte, err error)

func (*EapAVP) GetType

func (a *EapAVP) GetType() AVPType

func (*EapAVP) GetValue

func (a *EapAVP) GetValue() interface{}

func (*EapAVP) String

func (a *EapAVP) String() string

func (*EapAVP) ValueAsString

func (a *EapAVP) ValueAsString() string

type Handler

type Handler struct {
	// 有的协议需要明文密码来做各种hash的事情
	// exist返回false可以踢掉客户端
	// 同步调用
	Auth func(username string) (password string, exist bool)
	// 计费开始,来了一条新连接
	// 根据协议规定 此处返回给客户端的包,不能发送任何有效信息(比如踢掉客户端,请采用其他办法踢掉客户端)
	// 异步调用
	AcctStart func(acctReq AcctRequest)
	// 计费数据更新
	// 根据协议规定 此处返回给客户端的包,不能发送任何有效信息(比如踢掉客户端,请采用其他办法踢掉客户端)
	// 异步调用
	AcctUpdate func(acctReq AcctRequest)
	// 计费结束
	// 根据协议规定 此处返回给客户端的包,不能发送任何有效信息(比如踢掉客户端,请采用其他办法踢掉客户端)
	// 异步调用
	AcctStop func(acctReq AcctRequest)
}

type IpAVP

type IpAVP struct {
	Type  AVPType
	Value net.IP
}

func (*IpAVP) Copy

func (a *IpAVP) Copy() AVP

func (*IpAVP) Encode

func (a *IpAVP) Encode() (b []byte, err error)

func (*IpAVP) GetType

func (a *IpAVP) GetType() AVPType

func (*IpAVP) GetValue

func (a *IpAVP) GetValue() interface{}

func (*IpAVP) String

func (a *IpAVP) String() string

func (*IpAVP) ValueAsString

func (a *IpAVP) ValueAsString() string

type MSMPPEEncryptionPolicy

type MSMPPEEncryptionPolicy uint32
const (
	MSMPPEEncryptionPolicyEncryptionAllowed  MSMPPEEncryptionPolicy = 1
	MSMPPEEncryptionPolicyEncryptionRequired MSMPPEEncryptionPolicy = 2
)

func (MSMPPEEncryptionPolicy) String

func (a MSMPPEEncryptionPolicy) String() string

type MSMPPEEncryptionTypes

type MSMPPEEncryptionTypes uint32
const (
	MSMPPEEncryptionTypesRC4Bit40      MSMPPEEncryptionTypes = 2
	MSMPPEEncryptionTypesRC4Bit128     MSMPPEEncryptionTypes = 4
	MSMPPEEncryptionTypesRC4Bit40Or128 MSMPPEEncryptionTypes = 6
)

func (MSMPPEEncryptionTypes) String

func (a MSMPPEEncryptionTypes) String() string

type MSMPPESendOrRecvKeyVSA

type MSMPPESendOrRecvKeyVSA struct {
	Type VendorType
	Salt [2]byte //最高位要是1
	Key  []byte
	// contains filtered or unexported fields
}

send or recv key

func NewMSMPPESendOrRecvKeyVSA

func NewMSMPPESendOrRecvKeyVSA(p *Packet, typ VendorType, key []byte) *MSMPPESendOrRecvKeyVSA

随机一个新的 MSMPPESendOrRecvKeyVSA 的对象

func (*MSMPPESendOrRecvKeyVSA) Encode

func (a *MSMPPESendOrRecvKeyVSA) Encode() (b []byte, err error)

func (*MSMPPESendOrRecvKeyVSA) GetType

func (a *MSMPPESendOrRecvKeyVSA) GetType() VendorType

func (*MSMPPESendOrRecvKeyVSA) GetValue

func (a *MSMPPESendOrRecvKeyVSA) GetValue() interface{}

func (*MSMPPESendOrRecvKeyVSA) SetPacket

func (a *MSMPPESendOrRecvKeyVSA) SetPacket(p *Packet)

func (*MSMPPESendOrRecvKeyVSA) String

func (a *MSMPPESendOrRecvKeyVSA) String() string

type NASPortTypeEnum

type NASPortTypeEnum uint32
const (
	NASPortTypeEnumAsync            NASPortTypeEnum = 0
	NASPortTypeEnumSync             NASPortTypeEnum = 1
	NASPortTypeEnumISDNSync         NASPortTypeEnum = 2
	NASPortTypeEnumISDNSyncV120     NASPortTypeEnum = 3
	NASPortTypeEnumISDNSyncV110     NASPortTypeEnum = 4
	NASPortTypeEnumVirtual          NASPortTypeEnum = 5
	NASPortTypeEnumPIAFS            NASPortTypeEnum = 6
	NASPortTypeEnumHDLCClearChannel NASPortTypeEnum = 7
	NASPortTypeEnumEthernet         NASPortTypeEnum = 15
	NASPortTypeEnumCable            NASPortTypeEnum = 17
)

TODO finish it

func (NASPortTypeEnum) String

func (e NASPortTypeEnum) String() string

type Packet

type Packet struct {
	Secret        []byte
	Code          Code
	Identifier    uint8
	Authenticator [16]byte //对应的Request请求里面的Authenticator.
	AVPs          []AVP
}

func DecodeRequestPacket

func DecodeRequestPacket(Secret []byte, buf []byte) (p *Packet, err error)

这个只能解密各种Request

func DecodeResponsePacket

func DecodeResponsePacket(Secret []byte, buf []byte, RequestAuthenticator [16]byte) (p *Packet, err error)

解密response包

func (*Packet) AddAVP

func (p *Packet) AddAVP(avp AVP)

func (*Packet) Copy

func (p *Packet) Copy() *Packet

func (*Packet) DeleteOneType

func (p *Packet) DeleteOneType(attrType AVPType)

delete all avps with this type

func (*Packet) Encode

func (p *Packet) Encode() (b []byte, err error)

此方法保证不修改包的内容

func (*Packet) GetAVP

func (p *Packet) GetAVP(attrType AVPType) AVP

get one avp

func (*Packet) GetAcctSessionId

func (p *Packet) GetAcctSessionId() string

func (*Packet) GetAcctSessionTime

func (p *Packet) GetAcctSessionTime() uint32

func (*Packet) GetAcctStatusType

func (p *Packet) GetAcctStatusType() AcctStatusTypeEnum

func (*Packet) GetAcctTotalInputOctets

func (p *Packet) GetAcctTotalInputOctets() uint64

func (*Packet) GetAcctTotalOutputOctets

func (p *Packet) GetAcctTotalOutputOctets() uint64

func (*Packet) GetEAPMessage

func (p *Packet) GetEAPMessage() eap.Packet

func (*Packet) GetNASIdentifier

func (p *Packet) GetNASIdentifier() string

func (*Packet) GetNASPort

func (p *Packet) GetNASPort() uint32

it is ike_id in strongswan client

func (*Packet) GetNasIpAddress

func (p *Packet) GetNasIpAddress() (ip net.IP)

func (*Packet) GetPassword

func (p *Packet) GetPassword() (password string)

func (*Packet) GetState

func (p *Packet) GetState() []byte

func (*Packet) GetUsername

func (p *Packet) GetUsername() (username string)

func (*Packet) GetVsa

func (p *Packet) GetVsa(typ VendorType) VSA

func (*Packet) Reply

func (p *Packet) Reply() *Packet

func (*Packet) Send

func (p *Packet) Send(c net.PacketConn, addr net.Addr) error

func (*Packet) SetAVP

func (p *Packet) SetAVP(avp AVP)

set one avp,remove all other same type

func (*Packet) SetAcctInterimInterval

func (p *Packet) SetAcctInterimInterval(second int)

func (*Packet) SetState

func (p *Packet) SetState(state []byte)

func (*Packet) String

func (p *Packet) String() string

func (*Packet) ToStringMap

func (p *Packet) ToStringMap() map[string]string

转成字符串map,便于进行log(序列化?),只有实际信息,已经把加密的东西剔除掉了

type PacketHandler

type PacketHandler func(request *Packet) *Packet

type PasswordAVP

type PasswordAVP struct {
	Value string // plain of password
	// contains filtered or unexported fields
}

func (*PasswordAVP) Copy

func (a *PasswordAVP) Copy() AVP

func (*PasswordAVP) Encode

func (a *PasswordAVP) Encode() (b []byte, err error)

you need set packet before encode

func (*PasswordAVP) GetType

func (a *PasswordAVP) GetType() AVPType

func (*PasswordAVP) GetValue

func (a *PasswordAVP) GetValue() interface{}

func (*PasswordAVP) SetPacket

func (a *PasswordAVP) SetPacket(p *Packet)

func (*PasswordAVP) String

func (a *PasswordAVP) String() string

func (*PasswordAVP) ValueAsString

func (a *PasswordAVP) ValueAsString() string

type ServiceTypeEnum

type ServiceTypeEnum uint32
const (
	ServiceTypeEnumLogin          ServiceTypeEnum = 1
	ServiceTypeEnumFramed         ServiceTypeEnum = 2
	ServiceTypeEnumCallbackLogin  ServiceTypeEnum = 3
	ServiceTypeEnumCallbackFramed ServiceTypeEnum = 4
	ServiceTypeEnumOutbound       ServiceTypeEnum = 5
)

TODO finish it

func (ServiceTypeEnum) String

func (e ServiceTypeEnum) String() string

type StringAVP

type StringAVP struct {
	Type  AVPType
	Value string
}

func (*StringAVP) Copy

func (a *StringAVP) Copy() AVP

func (*StringAVP) Encode

func (a *StringAVP) Encode() (b []byte, err error)

func (*StringAVP) GetType

func (a *StringAVP) GetType() AVPType

func (*StringAVP) GetValue

func (a *StringAVP) GetValue() interface{}

func (*StringAVP) String

func (a *StringAVP) String() string

func (*StringAVP) ValueAsString

func (a *StringAVP) ValueAsString() string

type Stringer

type Stringer interface {
	String() string
}

type Uint32AVP

type Uint32AVP struct {
	Type  AVPType
	Value uint32
}

func (*Uint32AVP) Copy

func (a *Uint32AVP) Copy() AVP

func (*Uint32AVP) Encode

func (a *Uint32AVP) Encode() (b []byte, err error)

func (*Uint32AVP) GetType

func (a *Uint32AVP) GetType() AVPType

func (*Uint32AVP) GetValue

func (a *Uint32AVP) GetValue() interface{}

func (*Uint32AVP) String

func (a *Uint32AVP) String() string

func (*Uint32AVP) ValueAsString

func (a *Uint32AVP) ValueAsString() string

type Uint32EnumAVP

type Uint32EnumAVP struct {
	Type  AVPType
	Value Stringer // value should derive from a uint32 type like AcctStatusTypeEnum
}

func (*Uint32EnumAVP) Copy

func (a *Uint32EnumAVP) Copy() AVP

func (*Uint32EnumAVP) Encode

func (a *Uint32EnumAVP) Encode() (b []byte, err error)

func (*Uint32EnumAVP) GetType

func (a *Uint32EnumAVP) GetType() AVPType

func (*Uint32EnumAVP) GetValue

func (a *Uint32EnumAVP) GetValue() interface{}

func (*Uint32EnumAVP) String

func (a *Uint32EnumAVP) String() string

func (*Uint32EnumAVP) ValueAsString

func (a *Uint32EnumAVP) ValueAsString() string

type Uint32EnumVSA

type Uint32EnumVSA struct {
	Type  VendorType
	Value Stringer // value should derive from a uint32 type like AcctStatusTypeEnum
}

func (*Uint32EnumVSA) Copy

func (a *Uint32EnumVSA) Copy() VSA

func (*Uint32EnumVSA) Encode

func (a *Uint32EnumVSA) Encode() (b []byte, err error)

func (*Uint32EnumVSA) GetType

func (a *Uint32EnumVSA) GetType() VendorType

func (*Uint32EnumVSA) GetValue

func (a *Uint32EnumVSA) GetValue() interface{}

func (*Uint32EnumVSA) String

func (a *Uint32EnumVSA) String() string

type VSA

type VSA interface {
	GetType() VendorType
	String() string
	Encode() (b []byte, err error)
}

Vendor Specific Attributes

type VendorId

type VendorId uint32

func (VendorId) String

func (a VendorId) String() string

type VendorSpecificAVP

type VendorSpecificAVP struct {
	Value VSA
}

func (*VendorSpecificAVP) Copy

func (a *VendorSpecificAVP) Copy() AVP

TODO real copy

func (*VendorSpecificAVP) Encode

func (a *VendorSpecificAVP) Encode() (b []byte, err error)

func (*VendorSpecificAVP) GetType

func (a *VendorSpecificAVP) GetType() AVPType

func (*VendorSpecificAVP) GetValue

func (a *VendorSpecificAVP) GetValue() interface{}

func (*VendorSpecificAVP) String

func (a *VendorSpecificAVP) String() string

func (*VendorSpecificAVP) ValueAsString

func (a *VendorSpecificAVP) ValueAsString() string

type VendorType

type VendorType uint8 //微软的?
const (
	VendorTypeMSMPPEEncryptionPolicy VendorType = 7
	VendorTypeMSMPPEEncryptionTypes  VendorType = 8
	VendorTypeMSMPPESendKey          VendorType = 16
	VendorTypeMSMPPERecvKey          VendorType = 17
)

func (VendorType) String

func (a VendorType) String() string

func (VendorType) VendorId

func (a VendorType) VendorId() VendorId

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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