eap

package
v0.0.0-...-1c6f898 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EapCode

type EapCode uint8
const (
	EAPRequest  EapCode = 1
	EAPResponse EapCode = 2
	EAPSuccess  EapCode = 3
	EAPFailure  EapCode = 4
)

type EapIdentity

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

func NewEapIdentity

func NewEapIdentity() *EapIdentity

func (*EapIdentity) Decode

func (packet *EapIdentity) Decode(buff []byte) bool

func (*EapIdentity) Encode

func (packet *EapIdentity) Encode() (bool, []byte)

func (*EapIdentity) GetIdentity

func (packet *EapIdentity) GetIdentity() string

func (*EapIdentity) SetIdentity

func (packet *EapIdentity) SetIdentity(value string)

func (*EapIdentity) String

func (packet *EapIdentity) String() string

type EapPacket

type EapPacket struct {
	Payload EapPayload
	// contains filtered or unexported fields
}

func (*EapPacket) Decode

func (packet *EapPacket) Decode(buff []byte) bool

This function decodes from a given slice with raw data the attributes that belongs to the EAP header (code, identifier, length, type).

func (*EapPacket) Dispatcher

func (p *EapPacket) Dispatcher()

func (*EapPacket) Encode

func (packet *EapPacket) Encode() (bool, []byte)

This function encodes the attributes of the header of an EAP message (code, id, length, type) and returns the encoded result in a slice. 1º retval: If success encoding, return true, else false. 2º retval: The encoded slice.

func (*EapPacket) GetCode

func (packet *EapPacket) GetCode() EapCode

func (*EapPacket) GetId

func (packet *EapPacket) GetId() uint8

func (*EapPacket) GetLength

func (packet *EapPacket) GetLength() uint16

func (*EapPacket) GetPayload

func (packet *EapPacket) GetPayload() *EapPayload

func (*EapPacket) GetType

func (packet *EapPacket) GetType() EapType

func (*EapPacket) SetCode

func (packet *EapPacket) SetCode(code EapCode)

func (*EapPacket) SetId

func (packet *EapPacket) SetId(id uint8)

func (*EapPacket) SetPayload

func (packet *EapPacket) SetPayload(p *EapPayload)

type EapPayload

type EapPayload interface {
	Decode(buff []byte) bool
	Encode() (bool, []byte)
	String() string
}

Interface that defines the functions common to any type of EAP message. Every EAP method should implement this interface.

func GetEapPayload

func GetEapPayload(msgType EapType) EapPayload

type EapType

type EapType uint8
const (
	Identity  EapType = 1
	LegacyNak EapType = 3
	Peap      EapType = 25
	MsChapv2  EapType = 26
	TLV       EapType = 33
	TLS       EapType = 13
)

type PacketFlag

type PacketFlag byte
const (
	FlagLength     PacketFlag = 1 << 7
	FlagMore       PacketFlag = 1 << 6
	FlagStart      PacketFlag = 1 << 5
	FlagNone       PacketFlag = 0
	FlagLengthMore PacketFlag = 0xc0
)

type PacketHeader

type PacketHeader struct {
	Flags  PacketFlag
	Length uint32
}

func (*PacketHeader) Decode

func (h *PacketHeader) Decode(buf []byte) bool

func (*PacketHeader) Encode

func (h *PacketHeader) Encode(dataLen int) []byte

func (*PacketHeader) EncodedLen

func (h *PacketHeader) EncodedLen() int

type TLSClient

type TLSClient struct {
	Conn    *tls.Conn
	Session *tls.ClientSessionState
	Hello   *tls.ClientHelloMsg
	Buf     []byte
	// contains filtered or unexported fields
}

func GetTLSClient

func GetTLSClient(config *tls.Config) *TLSClient

func (*TLSClient) MakeEapIdentity

func (client *TLSClient) MakeEapIdentity(id uint8, identity string) []byte

func (*TLSClient) MakeTLSHello

func (client *TLSClient) MakeTLSHello(id uint8) []byte

func (*TLSClient) SendClientCertificate

func (client *TLSClient) SendClientCertificate(id uint8, l int) ([]byte, bool)

func (*TLSClient) SendPendingBuffer

func (client *TLSClient) SendPendingBuffer(id uint8, l int) ([]byte, bool)

func (*TLSClient) SendTLSEmpty

func (client *TLSClient) SendTLSEmpty() []byte

func (*TLSClient) SendTLSHello

func (client *TLSClient) SendTLSHello(id uint8) []byte

func (*TLSClient) WriteHand

func (t *TLSClient) WriteHand(b []byte)

type TLSPacket

type TLSPacket struct {
	PacketHeader
	Data []byte
}

TLS Packet

func (*TLSPacket) Decode

func (p *TLSPacket) Decode(buff []byte) bool

func (*TLSPacket) Encode

func (p *TLSPacket) Encode() (bool, []byte)

func (*TLSPacket) String

func (p *TLSPacket) String() string

Jump to

Keyboard shortcuts

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