server

package
v0.0.0-...-3ae5686 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PacketServer

func PacketServer(captureDevice string) error

PacketServer is the main function when operating in server mode it sets up the pcap on the capture device and starts a goroutine to rotate the knock sequence

Types

type Client

type Client struct {
	Progress    int       // index of current progress in sequence.   Value of 1 means first port has been matched
	Sequence    [4]uint16 // stores the knock sequence the current client is attempting.  It's set and tracked here to prevent race conditions during a knock sequence being received and key rotations
	LastUpdated time.Time // The last time the client sent a correct packet in the sequence
}

Client is used to keep track of a client attempting to perform an authentic knock sequence

type KnockSequence

type KnockSequence struct {
	Used         bool      // If true, that means this knock sequence has already been used once.  It may still be within the valid time window, but it can't be used again
	PortSequence [4]uint16 // Each knock sequence is four ports long
}

KnockSequence is used keep track of an ordered knock sequence and whether it's been marked for use (to prevent replay attacks)

Jump to

Keyboard shortcuts

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