ppp

package
v1.3.3-rc7 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PPP_LCP  uint16 = 0xc021
	PPP_PAP  uint16 = 0xc023
	PPP_CHAP uint16 = 0xc223

	LCP_REQ uint8 = 0x1
	LCP_ACK uint8 = 0x2
	LCP_NCK uint8 = 0x3
	LCP_REJ uint8 = 0x4

	LCP_OPTION_AUTH uint8 = 0x3

	CHAP_MD5   = []byte{0xc2, 0x23, 0x05}
	MS_CHAP_V2 = []byte{0xc2, 0x23, 0x81}
	PAP        = []byte{0xc0, 0x23}

	CHAP_CHALLENGE uint8 = 0x1
	CHAP_SUCCESS   uint8 = 0x3
	CHAP_FAILURE   uint8 = 0x4

	PAP_ACK uint8 = 0x2
	PAP_NAK uint8 = 0x3

	SupportAuthTypeMap = map[string][]byte{
		"CHAP":     CHAP_MD5,
		"MSCHAPV2": MS_CHAP_V2,
		"PAP":      PAP,
	}
)

Functions

func ChallengeHash

func ChallengeHash(peerChallenge, authenticatorChallenge, username []byte) []byte

ChallengeHash - rfc2759, 8.2

func ChallengeResponse

func ChallengeResponse(challenge, passwordHash []byte) []byte

ChallengeResponse - rfc2759, 8.5

func DESCrypt

func DESCrypt(key, clear []byte) []byte

DESCrypt - rfc2759, 8.6

func GenerateCHAPMD5Response

func GenerateCHAPMD5Response(id, password, challenge []byte) []byte

func GenerateCHAPResponse

func GenerateCHAPResponse(id, challenge, username, password, autype []byte) ([]byte, error)

func GenerateMSChapV2Response

func GenerateMSChapV2Response(authenticatorChallenge, username, password []byte) ([]byte, error)

func GenerateNTResponse

func GenerateNTResponse(authenticatorChallenge, peerChallenge, username, password []byte) ([]byte, error)

func NTPasswordHash

func NTPasswordHash(password []byte) []byte

NTPasswordHash with MD4 - rfc2759, 8.3

func ToUTF16

func ToUTF16(in []byte) ([]byte, error)

Types

type PPPAuth

type PPPAuth struct {
	Username           string
	Password           string
	AuthTypeCode       []byte
	AuthTypeName       string
	CanUseAuthTypeList map[string][]byte
	AuthOk             chan bool
	NegotiateOk        chan struct{}
	MagicNumber        []byte
	// contains filtered or unexported fields
}

func GetDefaultPPPAuth

func GetDefaultPPPAuth() *PPPAuth

func (*PPPAuth) AuthTypeCanUse

func (p *PPPAuth) AuthTypeCanUse(authType []byte) bool

func (*PPPAuth) ChangeAuthType

func (p *PPPAuth) ChangeAuthType(rejectType []byte) error

func (*PPPAuth) GetLCPConfigReqParams

func (p *PPPAuth) GetLCPConfigReqParams(id int) map[string]any

func (*PPPAuth) GetPAPReqParams

func (p *PPPAuth) GetPAPReqParams() map[string]any

func (*PPPAuth) GetPPPStartReqParams

func (p *PPPAuth) GetPPPStartReqParams() map[string]any

func (*PPPAuth) ProcessCHAPMessage

func (p *PPPAuth) ProcessCHAPMessage(messageNode *base.Node) (map[string]any, error)

func (*PPPAuth) ProcessLCPMessage

func (p *PPPAuth) ProcessLCPMessage(messageNode *base.Node) (map[string]any, error)

func (*PPPAuth) ProcessMessage

func (p *PPPAuth) ProcessMessage(messageNode *base.Node) (map[string]any, error)

func (*PPPAuth) ProcessPAPMessage

func (p *PPPAuth) ProcessPAPMessage(messageNode *base.Node) (map[string]any, error)

func (*PPPAuth) SetAuthType

func (p *PPPAuth) SetAuthType(authType []byte) error

Jump to

Keyboard shortcuts

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