Documentation ¶
Overview ¶
Package lcp implements PPP, LCP, IPCP and IPv6CP
Index ¶
- Constants
- Variables
- type CHAPAuthAlg
- type DefaultIP6CPRule
- type DefaultIPCPOwnRule
- type DefaultIPCPPeerRule
- type DefaultOwnOptionRule
- type DefaultPeerOptionRule
- type GenericOption
- type IPCP6OptionType
- type IPCPOptionType
- type IPv4AddrOption
- type InterfaceIDOption
- func (ifid *InterfaceIDOption) Equal(b Option) bool
- func (ifid *InterfaceIDOption) GetPayload() []byte
- func (ifid *InterfaceIDOption) Parse(buf []byte) (int, error)
- func (ifid *InterfaceIDOption) Serialize() ([]byte, error)
- func (ifid InterfaceIDOption) String() string
- func (ifid *InterfaceIDOption) Type() uint8
- type LCP
- type LCPOpAuthProto
- func (authp LCPOpAuthProto) Equal(b Option) bool
- func (authp *LCPOpAuthProto) GetPayload() []byte
- func (authp *LCPOpAuthProto) Parse(buf []byte) (int, error)
- func (authp *LCPOpAuthProto) Serialize() ([]byte, error)
- func (authp LCPOpAuthProto) String() string
- func (authp *LCPOpAuthProto) Type() uint8
- type LCPOpMRU
- type LCPOpMagicNum
- type LCPOptionType
- type LayerNotifyEvent
- type LayerNotifyHandler
- type Modifier
- type MsgCode
- type Option
- type Options
- type OwnOptionRule
- type PPP
- type PPPConn
- func (pconn *PPPConn) Close() error
- func (pconn *PPPConn) Register(k etherconn.L4RecvKey) (torecvch chan *etherconn.RelayReceival)
- func (pconn *PPPConn) RegisterList(keys []etherconn.L4RecvKey) (torecvch chan *etherconn.RelayReceival)
- func (pconn *PPPConn) SetWriteDeadline(t time.Time) error
- func (pconn *PPPConn) WriteIPPktTo(p []byte, dstmac net.HardwareAddr) (int, error)
- type PPPPkt
- type PPPProtocolNumber
- type PeerOptionRule
- type Pkt
- type State
Constants ¶
const ( // DefaultRestartCounter is the default LCP restart counter value DefaultRestartCounter = 3 // DefaultRestartTimerDuration is the default restart timer DefaultRestartTimerDuration = 10 * time.Second // DefaultKeepAliveInterval is the default LCP keepalive interval to send DefaultKeepAliveInterval = 5 * time.Second // DefaultMRU is the default LCP MRU value DefaultMRU = 1500 // DefaultAuthProto is the default auth protocol DefaultAuthProto = ProtoCHAP // DefaultMagicNum is the default LCP magic number DefaultMagicNum LCPOpMagicNum = 0 )
const (
DefaultPerClntRecvChanDepth = 1024
)
const (
// MaxPPPMsgSize specifies max length of a received PPP pkt
MaxPPPMsgSize = 1500
)
Variables ¶
var IPv6LinkLocalPrefix = []byte{0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
IPv6LinkLocalPrefix is the IPv6 Link Local prefix
Functions ¶
This section is empty.
Types ¶
type CHAPAuthAlg ¶
type CHAPAuthAlg uint8
CHAPAuthAlg is the auth alg of CHAP
const ( AlgNone CHAPAuthAlg = 0 AlgCHAPwithMD5 CHAPAuthAlg = 5 AlgSHA1 CHAPAuthAlg = 6 AlgCHAPwithSHA256 CHAPAuthAlg = 7 AlgCHAPwithSHA3256 CHAPAuthAlg = 8 AlgMSCHAP CHAPAuthAlg = 128 AlgMSCHAP2 CHAPAuthAlg = 129 )
list of CHAP alg
func (CHAPAuthAlg) String ¶
func (alg CHAPAuthAlg) String() string
type DefaultIP6CPRule ¶
type DefaultIP6CPRule struct { IfID *InterfaceIDOption // contains filtered or unexported fields }
DefaultIP6CPRule implements both OwnOptionRule and PeerOptionRule interface; only negotiate interface-id option
func NewDefaultIP6CPRule ¶
func NewDefaultIP6CPRule(ctx context.Context, mac net.HardwareAddr) *DefaultIP6CPRule
NewDefaultIP6CPRule returns a new DefaultIP6CPRule; using a interface-id option that is derived from the mac;
func (*DefaultIP6CPRule) GetOption ¶
func (r *DefaultIP6CPRule) GetOption(t uint8) Option
GetOption implements OwnOptionRule interface, return nil if t is not interface-id
func (*DefaultIP6CPRule) GetOptions ¶
func (r *DefaultIP6CPRule) GetOptions() Options
GetOptions implements OwnOptionRule interface, return own interface id
func (*DefaultIP6CPRule) HandlerConfNAK ¶
func (r *DefaultIP6CPRule) HandlerConfNAK(rcvd Options)
HandlerConfNAK implements OwnOptionRule interface, generate a new inteface-id if interface-id is naked,
func (*DefaultIP6CPRule) HandlerConfRej ¶
func (r *DefaultIP6CPRule) HandlerConfRej(rcvd Options)
HandlerConfRej implements OwnOptionRule interface, if interface-id is rejected, then setting own interface-id to nil
func (*DefaultIP6CPRule) HandlerConfReq ¶
func (r *DefaultIP6CPRule) HandlerConfReq(rcvd Options) (nak, reject Options)
HandlerConfReq implements PeerOptionRule interface, follow section 4.1 of RFC5072 in terms nak or reject peer's inteface-id
type DefaultIPCPOwnRule ¶
type DefaultIPCPOwnRule struct { Addr net.IP DNS net.IP SecondaryDNS net.IP NBNS net.IP SecondaryNBNS net.IP // contains filtered or unexported fields }
DefaultIPCPOwnRule is the default OwnOptionRule for the IPCP protocol, it implements OwnOptionRule interface
func NewDefaultIPCPOwnRule ¶
func NewDefaultIPCPOwnRule() *DefaultIPCPOwnRule
NewDefaultIPCPOwnRule returns a new DefaultIPCPOwnRule, with all address set to 0.0.0.0
func (*DefaultIPCPOwnRule) GetOption ¶
func (own *DefaultIPCPOwnRule) GetOption(o uint8) Option
GetOption implements OwnOptionRule interface;
func (*DefaultIPCPOwnRule) GetOptions ¶
func (own *DefaultIPCPOwnRule) GetOptions() Options
GetOptions implements OwnOptionRule interface; a field will not be included as own option if it is nil
func (*DefaultIPCPOwnRule) HandlerConfNAK ¶
func (own *DefaultIPCPOwnRule) HandlerConfNAK(rcvd Options)
HandlerConfNAK implements OwnOptionRule interface; option value in received conf-nak will be used as own value in next conf-req;
func (*DefaultIPCPOwnRule) HandlerConfRej ¶
func (own *DefaultIPCPOwnRule) HandlerConfRej(rcvd Options)
HandlerConfRej implements OwnOptionRule interface; option in conf-reject will not be included in next conf-req;
type DefaultIPCPPeerRule ¶
type DefaultIPCPPeerRule struct{}
DefaultIPCPPeerRule implments PeerOptionRule interface; it ignores all peer options
func (*DefaultIPCPPeerRule) GetOptions ¶
func (peer *DefaultIPCPPeerRule) GetOptions() Options
GetOptions implments PeerOptionRule interface; always return nil
func (*DefaultIPCPPeerRule) HandlerConfReq ¶
func (peer *DefaultIPCPPeerRule) HandlerConfReq(rcvd Options) (nak, reject Options)
HandlerConfReq implments PeerOptionRule interface; it will reject any options other than OpIPAddress, and ACK any OpIPAddress value;
type DefaultOwnOptionRule ¶
type DefaultOwnOptionRule struct {
// contains filtered or unexported fields
}
DefaultOwnOptionRule is the default OwnOptionRule implementation; use NewDefaultOwnOptionRule() to create instance; using following options: MRU, AuthProto, MagicNumber with default value;
func NewDefaultOwnOptionRule ¶
func NewDefaultOwnOptionRule() *DefaultOwnOptionRule
NewDefaultOwnOptionRule returns a new DefaultOwnOptionRule
func (*DefaultOwnOptionRule) GetOption ¶
func (own *DefaultOwnOptionRule) GetOption(o uint8) Option
GetOption implements OwnOptionRule
func (*DefaultOwnOptionRule) GetOptions ¶
func (own *DefaultOwnOptionRule) GetOptions() Options
GetOptions implements OwnOptionRule
func (*DefaultOwnOptionRule) HandlerConfNAK ¶
func (own *DefaultOwnOptionRule) HandlerConfNAK(rcvd Options)
HandlerConfNAK implements OwnOptionRule, accept all options listed in conf-nak
func (*DefaultOwnOptionRule) HandlerConfRej ¶
func (own *DefaultOwnOptionRule) HandlerConfRej(rcvd Options)
HandlerConfRej implements OwnOptionRule, remove all options listed in conf-rej
type DefaultPeerOptionRule ¶
type DefaultPeerOptionRule struct { // AuthOp is the required Auth Protocol Option (PAP or CHAP) AuthOp *LCPOpAuthProto // contains filtered or unexported fields }
DefaultPeerOptionRule is the default PeerOptionRule implementation.
func NewDefaultPeerOptionRule ¶
func NewDefaultPeerOptionRule(authp PPPProtocolNumber) (*DefaultPeerOptionRule, error)
NewDefaultPeerOptionRule create a new DefaultPeerOptionRule instance with specified authp (
func (*DefaultPeerOptionRule) GetOptions ¶
func (rule *DefaultPeerOptionRule) GetOptions() Options
GetOptions implements PeerOptionRule.
func (*DefaultPeerOptionRule) HandlerConfReq ¶
func (rule *DefaultPeerOptionRule) HandlerConfReq(rcvd Options) (nak, reject Options)
HandlerConfReq implements PeerOptionRule, if config-request include an auth-proto option that is different from required one, it will be NAKed; Option in conf-req other than auth-proto, magic number and MRU will be rejected.
type GenericOption ¶
type GenericOption struct {
// contains filtered or unexported fields
}
GenericOption is general LCP/IPCP/IPv6CP option that doesn't have explicit support
func NewGenericOption ¶
func NewGenericOption(p PPPProtocolNumber) (*GenericOption, error)
NewGenericOption creates a new GenericOption with p as the specified protocol; only LCP/IPCP/IPv6CP are supported;
func (GenericOption) Equal ¶
func (gop GenericOption) Equal(b Option) bool
Equal implements Option interface
func (GenericOption) GetPayload ¶
func (gop GenericOption) GetPayload() []byte
GetPayload implements Option interface
func (*GenericOption) Parse ¶
func (gop *GenericOption) Parse(buf []byte) (int, error)
Parse implements Option interface
func (GenericOption) Serialize ¶
func (gop GenericOption) Serialize() ([]byte, error)
Serialize implements Option interface
func (GenericOption) String ¶
func (gop GenericOption) String() string
String implements Option interface
type IPCP6OptionType ¶
type IPCP6OptionType uint8
IPCP6OptionType is the option type for IPv6CP
const ( IP6CPOpIPv6CompressionProtocol IPCP6OptionType = 0x2 IP6CPOpInterfaceIdentifier IPCP6OptionType = 0x1 )
list of IPv6CP option type
func (IPCP6OptionType) String ¶
func (code IPCP6OptionType) String() string
type IPCPOptionType ¶
type IPCPOptionType uint8
IPCPOptionType is the option type for IPCP
const ( OpIPAddresses IPCPOptionType = 1 OpIPCompressionProtocol IPCPOptionType = 2 OpIPAddress IPCPOptionType = 3 OpMobileIPv4 IPCPOptionType = 4 OpPrimaryDNSServerAddress IPCPOptionType = 129 OpPrimaryNBNSServerAddress IPCPOptionType = 130 OpSecondaryDNSServerAddress IPCPOptionType = 131 OpSecondaryNBNSServerAddress IPCPOptionType = 132 )
list of IPCP option type
func (IPCPOptionType) String ¶
func (o IPCPOptionType) String() string
type IPv4AddrOption ¶
type IPv4AddrOption struct { Addr net.IP AddrType IPCPOptionType }
IPv4AddrOption represents IPCP option contains a single v4 addr like IP-Addr, DNS
func (*IPv4AddrOption) Equal ¶
func (addr *IPv4AddrOption) Equal(b Option) bool
Equal implments Option interface
func (IPv4AddrOption) GetPayload ¶
func (addr IPv4AddrOption) GetPayload() []byte
GetPayload implments Option interface
func (*IPv4AddrOption) Parse ¶
func (addr *IPv4AddrOption) Parse(buf []byte) (int, error)
Parse implments Option interface
func (*IPv4AddrOption) Serialize ¶
func (addr *IPv4AddrOption) Serialize() ([]byte, error)
Serialize implments Option interface
func (IPv4AddrOption) String ¶
func (addr IPv4AddrOption) String() string
String implments Option interface
func (*IPv4AddrOption) Type ¶
func (addr *IPv4AddrOption) Type() uint8
Type implments Option interface
type InterfaceIDOption ¶
type InterfaceIDOption [8]byte
InterfaceIDOption is the IPv6CP interface ID option
func (*InterfaceIDOption) Equal ¶
func (ifid *InterfaceIDOption) Equal(b Option) bool
Equal implements Option interface
func (*InterfaceIDOption) GetPayload ¶
func (ifid *InterfaceIDOption) GetPayload() []byte
GetPayload implements Option interface
func (*InterfaceIDOption) Parse ¶
func (ifid *InterfaceIDOption) Parse(buf []byte) (int, error)
Parse implements Option interface
func (*InterfaceIDOption) Serialize ¶
func (ifid *InterfaceIDOption) Serialize() ([]byte, error)
Serialize implements Option interface
func (InterfaceIDOption) String ¶
func (ifid InterfaceIDOption) String() string
String implements Option interface
func (*InterfaceIDOption) Type ¶
func (ifid *InterfaceIDOption) Type() uint8
Type implements Option interface
type LCP ¶
type LCP struct { // OwnRule is the OwnOptionRule to handle own options OwnRule OwnOptionRule // PeerRule is the PeerOptionRule to handle peer's options PeerRule PeerOptionRule // contains filtered or unexported fields }
LCP is the struct for LCP/IPCP/IPv6CP
func NewLCP ¶
func NewLCP(ctx context.Context, proto PPPProtocolNumber, pppProto *PPP, h LayerNotifyHandler, mods ...Modifier) *LCP
NewLCP creates a new LCP/IPCP/IPv6CP according to the specific proto, runs over specified pppProto, calls h whenever there is layer event. optionly, LCPModifier(s) could be specified to change default config
type LCPOpAuthProto ¶
type LCPOpAuthProto struct { Proto PPPProtocolNumber CHAPAlg CHAPAuthAlg Payload []byte }
LCPOpAuthProto is the LCP auth protocol option
func NewCHAPAuthOp ¶
func NewCHAPAuthOp() *LCPOpAuthProto
NewCHAPAuthOp returns a new CHAP LCPOpAuthProto with MD5
func NewPAPAuthOp ¶
func NewPAPAuthOp() *LCPOpAuthProto
NewPAPAuthOp returns a new PAP LCPOpAuthProto
func (LCPOpAuthProto) Equal ¶
func (authp LCPOpAuthProto) Equal(b Option) bool
Equal implements Option interface
func (*LCPOpAuthProto) GetPayload ¶
func (authp *LCPOpAuthProto) GetPayload() []byte
GetPayload implements Option interface
func (*LCPOpAuthProto) Parse ¶
func (authp *LCPOpAuthProto) Parse(buf []byte) (int, error)
Parse implements Option interface
func (*LCPOpAuthProto) Serialize ¶
func (authp *LCPOpAuthProto) Serialize() ([]byte, error)
Serialize implements Option interface
func (LCPOpAuthProto) String ¶
func (authp LCPOpAuthProto) String() string
String implements Option interface
func (*LCPOpAuthProto) Type ¶
func (authp *LCPOpAuthProto) Type() uint8
Type implements Option interface
type LCPOpMRU ¶
type LCPOpMRU uint16
LCPOpMRU is the LCP MRU option
func (LCPOpMRU) GetPayload ¶
GetPayload implements Option interface
type LCPOpMagicNum ¶
type LCPOpMagicNum uint32
LCPOpMagicNum is the LCP magic number option
func (LCPOpMagicNum) Equal ¶
func (mn LCPOpMagicNum) Equal(b Option) bool
Equal implements Option interface
func (LCPOpMagicNum) GetPayload ¶
func (mn LCPOpMagicNum) GetPayload() []byte
GetPayload implements Option interface
func (*LCPOpMagicNum) Parse ¶
func (mn *LCPOpMagicNum) Parse(buf []byte) (int, error)
Parse implements Option interface
func (LCPOpMagicNum) Serialize ¶
func (mn LCPOpMagicNum) Serialize() ([]byte, error)
Serialize implements Option interface
func (LCPOpMagicNum) String ¶
func (mn LCPOpMagicNum) String() string
String implements Option interface
type LCPOptionType ¶
type LCPOptionType uint8
LCPOptionType is the LCP option type
const ( OpTypeMaximumReceiveUnit LCPOptionType = 1 OpTypeAuthenticationProtocol LCPOptionType = 3 OpTypeQualityProtocol LCPOptionType = 4 OpTypeMagicNumber LCPOptionType = 5 OpTypeProtocolFieldCompression LCPOptionType = 7 OpTypeAddressandControlFieldCompression LCPOptionType = 8 )
LCP option types
func (LCPOptionType) String ¶
func (op LCPOptionType) String() string
type LayerNotifyEvent ¶
type LayerNotifyEvent uint8
LayerNotifyEvent is the tlu/tld/tls/tlf event defined in RFC1661
const ( LCPLayerNotifyUp LayerNotifyEvent = iota LCPLayerNotifyDown LCPLayerNotifyStarted LCPLayerNotifyFinished )
list of LayerNotifyEvent
func (LayerNotifyEvent) String ¶
func (n LayerNotifyEvent) String() string
type LayerNotifyHandler ¶
type LayerNotifyHandler func(ctx context.Context, evt LayerNotifyEvent)
LayerNotifyHandler is the handler function to handle Layer event (tlu/tld/tls/tlf as defined in RFC1661)
type Modifier ¶
type Modifier func(lcp *LCP)
Modifier provides custom configuration for NewLCP()
func WithOwnOptionRule ¶
func WithOwnOptionRule(r OwnOptionRule) Modifier
WithOwnOptionRule specify r as the OwnOptionRule
func WithPeerOptionRule ¶
func WithPeerOptionRule(r PeerOptionRule) Modifier
WithPeerOptionRule specify r as the PeerOptionRule
type MsgCode ¶
type MsgCode uint8
MsgCode is the LCP message Code
const ( CodeConfigureRequest MsgCode = 1 CodeConfigureAck MsgCode = 2 CodeConfigureNak MsgCode = 3 CodeConfigureReject MsgCode = 4 CodeTerminateRequest MsgCode = 5 CodeTerminateAck MsgCode = 6 CodeCodeReject MsgCode = 7 CodeProtocolReject MsgCode = 8 CodeEchoRequest MsgCode = 9 CodeEchoReply MsgCode = 10 CodeDiscardRequest MsgCode = 11 )
LCP message codes
type Option ¶
type Option interface { // Serialize option into bytes Serialize() ([]byte, error) // Parse buf into the option, return length of used bytes Parse(buf []byte) (int, error) // return option type as uint8 Type() uint8 // return payload bytes GetPayload() []byte // String returns a string representation of the option String() string // return true if b has same value and type Equal(b Option) bool }
Option is the LCP/IPCP/IPv6 option interface
type Options ¶
type Options []Option
Options is a slice of LCPOption
type OwnOptionRule ¶
type OwnOptionRule interface { // HandlerConfRej is the handler function to handle received Conf-Reject HandlerConfRej(rcvd Options) // HandlerConfNAK is the handler function to handle received Conf-Nak HandlerConfNAK(rcvd Options) // GetOptions returns current own options GetOptions() Options // GetOption returns current option with type o GetOption(o uint8) Option }
OwnOptionRule is rule that used to handle own LCP options, user could provide implementation of this interface to get custom behavior
type PPP ¶
type PPP struct {
// contains filtered or unexported fields
}
PPP is the PPP protcol, other protocol like IPv4/IPv6/LCP/IPCP/IPv6CP runs over it
func NewPPP ¶
NewPPP creates a new PPP protocol instance, using conn as underlying transport, l as logger;
func (*PPP) Register ¶
func (ppp *PPP) Register(p PPPProtocolNumber) (send, recv chan []byte)
Register a new protocol to run over ppp; return two byte slice channels, send could use to send pkt over ppp, recv is used to recv pkt from ppp
func (*PPP) UnRegister ¶ added in v0.2.0
func (ppp *PPP) UnRegister(p PPPProtocolNumber)
Un-register the protocol;
type PPPConn ¶ added in v0.2.0
type PPPConn struct {
// contains filtered or unexported fields
}
PPPConn implements etherconn.SharedEconn interface, could be used to fwd network packets over PPP
func NewPPPConn ¶ added in v0.2.0
func NewPPPConn(ctx context.Context, ppp *PPP, proto PPPProtocolNumber) *PPPConn
NewPPPConn creates a new PPPConn over ppp, for network protocol proto. it implements etherconn.SharedEconn interface
func (*PPPConn) Register ¶ added in v0.2.0
func (pconn *PPPConn) Register(k etherconn.L4RecvKey) (torecvch chan *etherconn.RelayReceival)
Register implements etherconn.SharedEconn interface
func (*PPPConn) RegisterList ¶ added in v0.2.0
func (pconn *PPPConn) RegisterList(keys []etherconn.L4RecvKey) (torecvch chan *etherconn.RelayReceival)
RegisterList register a list of keys
func (*PPPConn) SetWriteDeadline ¶ added in v0.2.0
SetWriteDeadline set deadline for WriteIPPktTo
func (*PPPConn) WriteIPPktTo ¶ added in v0.2.0
WriteIPPktTo implements etherconn.SharedEconn interface, dstmac is not used
type PPPPkt ¶
type PPPPkt struct { Proto PPPProtocolNumber Payload []byte }
PPPPkt is the PPP packet
func NewPPPPkt ¶
func NewPPPPkt(payload []byte, proto PPPProtocolNumber) *PPPPkt
NewPPPPkt return a new PPPPkt with proto and payload
type PPPProtocolNumber ¶
type PPPProtocolNumber uint16
PPPProtocolNumber is the PPP protocol number
const ( ProtoNone PPPProtocolNumber = 0 ProtoPAD PPPProtocolNumber = 0x1 ProtoIPv4 PPPProtocolNumber = 0x21 ProtoIPv6 PPPProtocolNumber = 0x57 ProtoLCP PPPProtocolNumber = 0xc021 ProtoPAP PPPProtocolNumber = 0xc023 ProtoCHAP PPPProtocolNumber = 0xc223 ProtoEAP PPPProtocolNumber = 0xc227 ProtoIPCP PPPProtocolNumber = 0x8021 ProtoIPv6CP PPPProtocolNumber = 0x8057 ProtoROHCsmallCID PPPProtocolNumber = 0x3 ProtoROHClargeCID PPPProtocolNumber = 0x5 ProtoOSINetworkLayer PPPProtocolNumber = 0x23 ProtoXeroxNSIDP PPPProtocolNumber = 0x25 ProtoDECnetPhaseIV PPPProtocolNumber = 0x27 ProtoAppletalk PPPProtocolNumber = 0x29 ProtoNovellIPX PPPProtocolNumber = 0x002b ProtoVanJacobsonCompressedTCPIP PPPProtocolNumber = 0x002d ProtoVanJacobsonUncompressedTCPIP PPPProtocolNumber = 0x002f ProtoBridgingPDU PPPProtocolNumber = 0x31 ProtoStreamProtocol PPPProtocolNumber = 0x33 ProtoBanyanVines PPPProtocolNumber = 0x35 ProtoUnassigned PPPProtocolNumber = 0x37 ProtoAppleTalkEDDP PPPProtocolNumber = 0x39 ProtoAppleTalkSmartBuffered PPPProtocolNumber = 0x003b ProtoMultiLink PPPProtocolNumber = 0x003d ProtoNETBIOSFraming PPPProtocolNumber = 0x003f ProtoCiscoSystems PPPProtocolNumber = 0x41 ProtoAscomTimeplex PPPProtocolNumber = 0x43 ProtoFujitsuLinkBackupandLoadBalancing PPPProtocolNumber = 0x45 ProtoDCARemoteLan PPPProtocolNumber = 0x47 ProtoSerialDataTransportProtocol PPPProtocolNumber = 0x49 ProtoSNAover802 PPPProtocolNumber = 0x004b ProtoSNA PPPProtocolNumber = 0x004d ProtoIPv6HeaderCompression PPPProtocolNumber = 0x004f ProtoKNXBridgingData PPPProtocolNumber = 0x51 ProtoEncryption PPPProtocolNumber = 0x53 ProtoIndividualLinkEncryption PPPProtocolNumber = 0x55 ProtoPPPMuxing PPPProtocolNumber = 0x59 ProtoVendorSpecificNetworkProtocol PPPProtocolNumber = 0x005b ProtoTRILLNetworkProtocol PPPProtocolNumber = 0x005d ProtoRTPIPHCFullHeader PPPProtocolNumber = 0x61 ProtoRTPIPHCCompressedTCP PPPProtocolNumber = 0x63 ProtoRTPIPHCCompressedNonTCP PPPProtocolNumber = 0x65 ProtoRTPIPHCCompressedUDP8 PPPProtocolNumber = 0x67 ProtoRTPIPHCCompressedRTP8 PPPProtocolNumber = 0x69 ProtoStampedeBridging PPPProtocolNumber = 0x006f ProtoMPPlus PPPProtocolNumber = 0x73 ProtoNTCITSIPI PPPProtocolNumber = 0x00c1 ProtoSinglelinkcompressioninmultilink PPPProtocolNumber = 0x00fb ProtoCompresseddatagram PPPProtocolNumber = 0x00fd ProtoHelloPackets8021d PPPProtocolNumber = 0x201 ProtoIBMSourceRoutingBPDU PPPProtocolNumber = 0x203 ProtoDECLANBridge100SpanningTree PPPProtocolNumber = 0x205 ProtoCiscoDiscoveryProtocol PPPProtocolNumber = 0x207 ProtoNetcsTwinRouting PPPProtocolNumber = 0x209 ProtoSTPScheduledTransferProtocol PPPProtocolNumber = 0x020b ProtoEDPExtremeDiscoveryProtocol PPPProtocolNumber = 0x020d ProtoOpticalSupervisoryChannelProtocol PPPProtocolNumber = 0x211 ProtoOpticalSupervisoryChannelProtocolAlias PPPProtocolNumber = 0x213 ProtoLuxcom PPPProtocolNumber = 0x231 ProtoSigmaNetworkSystems PPPProtocolNumber = 0x233 ProtoAppleClientServerProtocol PPPProtocolNumber = 0x235 ProtoMPLSUnicast PPPProtocolNumber = 0x281 ProtoMPLSMulticast PPPProtocolNumber = 0x283 ProtoIEEEp12844standarddatapackets PPPProtocolNumber = 0x285 ProtoETSITETRANetworkProtocolType1 PPPProtocolNumber = 0x287 ProtoMultichannelFlowTreatmentProtocol PPPProtocolNumber = 0x289 ProtoRTPIPHCCompressedTCPNoDelta PPPProtocolNumber = 0x2063 ProtoRTPIPHCContextState PPPProtocolNumber = 0x2065 ProtoRTPIPHCCompressedUDP16 PPPProtocolNumber = 0x2067 ProtoRTPIPHCCompressedRTP16 PPPProtocolNumber = 0x2069 ProtoCrayCommunicationsControlProtocol PPPProtocolNumber = 0x4001 ProtoCDPDMobileNetworkRegistrationProtocol PPPProtocolNumber = 0x4003 ProtoExpandacceleratorprotocol PPPProtocolNumber = 0x4005 ProtoODSICPNCP PPPProtocolNumber = 0x4007 ProtoDOCSISDLL PPPProtocolNumber = 0x4009 ProtoCetaceanNetworkDetectionProtocol PPPProtocolNumber = 0x400B ProtoStackerLZS PPPProtocolNumber = 0x4021 ProtoRefTekProtocol PPPProtocolNumber = 0x4023 ProtoFibreChannel PPPProtocolNumber = 0x4025 ProtoOpenDOF PPPProtocolNumber = 0x4027 ProtoVendorSpecificProtocol PPPProtocolNumber = 0x405b ProtoTRILLLinkStateProtocol PPPProtocolNumber = 0x405d ProtoOSINetworkLayerControlProtocol PPPProtocolNumber = 0x8023 ProtoXeroxNSIDPControlProtocol PPPProtocolNumber = 0x8025 ProtoDECnetPhaseIVControlProtocol PPPProtocolNumber = 0x8027 ProtoAppletalkControlProtocol PPPProtocolNumber = 0x8029 ProtoNovellIPXControlProtocol PPPProtocolNumber = 0x802b ProtoBridgingNCP PPPProtocolNumber = 0x8031 ProtoStreamProtocolControlProtocol PPPProtocolNumber = 0x8033 ProtoBanyanVinesControlProtocol PPPProtocolNumber = 0x8035 ProtoMultiLinkControlProtocol PPPProtocolNumber = 0x803d ProtoNETBIOSFramingControlProtocol PPPProtocolNumber = 0x803f ProtoCiscoSystemsControlProtocol PPPProtocolNumber = 0x8041 ProtoAscomTimeplexAlias PPPProtocolNumber = 0x8043 ProtoFujitsuLBLBControlProtocol PPPProtocolNumber = 0x8045 ProtoDCARemoteLanNetworkControlProtocol PPPProtocolNumber = 0x8047 ProtoSerialDataControlProtocol PPPProtocolNumber = 0x8049 ProtoSNAover802Control PPPProtocolNumber = 0x804b ProtoSNAControlProtocol PPPProtocolNumber = 0x804d ProtoIP6HeaderCompressionControlProtocol PPPProtocolNumber = 0x804f ProtoKNXBridgingControlProtocol PPPProtocolNumber = 0x8051 ProtoEncryptionControlProtocol PPPProtocolNumber = 0x8053 ProtoIndividualLinkEncryptionControlProtocol PPPProtocolNumber = 0x8055 ProtoPPPMuxingControlProtocol PPPProtocolNumber = 0x8059 ProtoVendorSpecificNetworkControlProtocol PPPProtocolNumber = 0x805b ProtoTRILLNetworkControlProtocol PPPProtocolNumber = 0x805d ProtoStampedeBridgingControlProtocol PPPProtocolNumber = 0x806f ProtoMPPlusControlProtocol PPPProtocolNumber = 0x8073 ProtoNTCITSIPIControlProtocol PPPProtocolNumber = 0x80c1 Protosinglelinkcompressioninmultilinkcontrol PPPProtocolNumber = 0x80fb ProtoCompressionControlProtocol PPPProtocolNumber = 0x80fd ProtoCiscoDiscoveryProtocolControl PPPProtocolNumber = 0x8207 ProtoNetcsTwinRoutingAlias PPPProtocolNumber = 0x8209 ProtoSTPControlProtocol PPPProtocolNumber = 0x820b ProtoEDPCPExtremeDiscoveryProtocolCtrlPrtcl PPPProtocolNumber = 0x820d ProtoAppleClientServerProtocolControl PPPProtocolNumber = 0x8235 ProtoMPLSCP PPPProtocolNumber = 0x8281 ProtoIEEEp12844standardProtocolControl PPPProtocolNumber = 0x8285 ProtoETSITETRATNP1ControlProtocol PPPProtocolNumber = 0x8287 ProtoMultichannelFlowTreatmentProtocolAlias PPPProtocolNumber = 0x8289 ProtoLinkQualityReport PPPProtocolNumber = 0xc025 ProtoShivaPasswordAuthenticationProtocol PPPProtocolNumber = 0xc027 ProtoCallBackControlProtocol PPPProtocolNumber = 0xc029 ProtoBACPBandwidthAllocationControlProtocolAlias PPPProtocolNumber = 0xc02b ProtoBAP PPPProtocolNumber = 0xc02d ProtoVendorSpecificAuthenticationProtocol PPPProtocolNumber = 0xc05b ProtoContainerControlProtocol PPPProtocolNumber = 0xc081 ProtoRSAAuthenticationProtocol PPPProtocolNumber = 0xc225 ProtoMitsubishiSecurityInfoExchPtcl PPPProtocolNumber = 0xc229 ProtoStampedeBridgingAuthorizationProtocol PPPProtocolNumber = 0xc26f ProtoProprietaryAuthenticationProtocol PPPProtocolNumber = 0xc281 ProtoProprietaryAuthenticationProtocolAlias PPPProtocolNumber = 0xc283 ProtoProprietaryNodeIDAuthenticationProtocol PPPProtocolNumber = 0xc481 )
list of PPP protocol number
func (PPPProtocolNumber) MarshalText ¶ added in v0.3.0
func (val PPPProtocolNumber) MarshalText() (text []byte, err error)
func (PPPProtocolNumber) String ¶
func (val PPPProtocolNumber) String() string
func (*PPPProtocolNumber) UnmarshalText ¶ added in v0.3.0
func (val *PPPProtocolNumber) UnmarshalText(text []byte) error
type PeerOptionRule ¶
type PeerOptionRule interface { // HandlerConfReq is the handler function to handle received Conf-Request. // if a recived option needs to be naked or rejected, include it in returned nak/reject LCPOptions HandlerConfReq(rcvd Options) (nak, reject Options) // GetOptions return current peer's options GetOptions() Options }
PeerOptionRule is rule that use for handle received config-req from peer
type Pkt ¶
type Pkt struct { // Proto is one of ProtoLCP, ProtoIPCP, ProtoIPv6CP Proto PPPProtocolNumber // Msg code Code MsgCode // Msg Id ID uint8 // Msg length Len uint16 // Magic Number if exists MagicNum uint32 // rejected protocol number if exists RejectedProto PPPProtocolNumber //LCP allows mulitple instances of same type of option, and require same order between cfg-request/response Options []Option // pkt payload Payload []byte }
Pkt represents a LCP/IPCP/IPv6CP pkt
func NewPkt ¶
func NewPkt(p PPPProtocolNumber) *Pkt
NewPkt return a new LCP/IPCP/IPv6CP Pkt based on p
func (*Pkt) GetOption ¶
func (p *Pkt) GetOption(optype LCPOptionType) (r []Option)
GetOption return a slice of options with type as optype