chap

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package chap implments CHAPwithMD5 as specified in rfc1994

Index

Constants

View Source
const DefaultTimeout = 10 * time.Second

DefaultTimeout is the default timeout for CHAP

Variables

This section is empty.

Functions

This section is empty.

Types

type CHAP

type CHAP struct {
	// contains filtered or unexported fields
}

CHAP is the CHAP protocol

func NewCHAP

func NewCHAP(uname, passwd string, pppProto *lcp.PPP) *CHAP

NewCHAP creates a new CHAP instance with specified uname,passwd; using pppProto as underlying PPP protocol

func (*CHAP) AUTHSelf

func (chap *CHAP) AUTHSelf() error

AUTHSelf auth self to peer, return nil if auth succeeds

type Code

type Code uint8

Code is the code of CHAP msg

const (
	CodeChallenge Code = 1
	CodeResponse  Code = 2
	CodeSuccess   Code = 3
	CodeFailure   Code = 4
)

list of CHAPCode

func (Code) String

func (c Code) String() string

String returns a string representation of c

type Pkt

type Pkt struct {
	Code   Code
	ID     uint8
	Len    uint16
	ValLen uint8
	Value  []byte
	Name   []byte
	Msg    []byte
}

Pkt represents a CHAP packet

func (*Pkt) Parse

func (cp *Pkt) Parse(buf []byte) error

Parse buf into cp

func (*Pkt) Serialize

func (cp *Pkt) Serialize() ([]byte, error)

Serialize cp into byte slice

func (Pkt) String

func (cp Pkt) String() string

String returns a string representation of cp

Jump to

Keyboard shortcuts

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