Documentation ¶
Index ¶
- Variables
- func SetupSpoofingSockets(config Config) error
- func SpoofIPv4Message(packet []byte) error
- func SpoofProbe(ctx context.Context, probe *traas2.Probe, inReplyTo gopacket.Packet, ...)
- func SpoofTCPMessage(src net.IP, dest net.IP, request *layers.TCP, requestLength uint16, ttl byte, ...) error
- type Config
- type Recorder
- type Server
- func (s *Server) EndHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) ErrorHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) ProbeHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) Serve() error
- func (s *Server) StartHandler(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
var ( // TestSpoofChannel can be set, causing spoofed packets to go to it rather than a pcap TestSpoofChannel chan []byte )
Functions ¶
func SetupSpoofingSockets ¶
SetupSpoofingSockets opens a raw pcap socket for sending packets
func SpoofIPv4Message ¶
SpoofIPv4Message sends a serialized packet on the raw socket.
Types ¶
type Config ¶
type Config struct { ServePort uint16 // What port for webServer ListenPort uint16 // What port for pcap Path string // What web path does traas live at Root string // where is the go code (and static files) for traas Device string // What network interface is listened to Dst string // Ethernet address of the gateway network interface IPHeader string // If client ips should be checked from e.g. an x-forwarded-for header TraceFile string // file to log traces. Debug bool // If diagnostic debugging should be enabled TraceLog *log.Logger `json:"-"` }
Config stores longterm state of how the server behaves
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder is the state of the pcap listener. Use begintrace / endTrace to interact with it, and let it know which packets it's watching for.
func MakeRecorder ¶
func MakeRecorder(netDev string, path string, port uint16, probe *traas2.Probe, debug bool) (*Recorder, error)
MakeRecorder initializes the system / pcap listening thread for a given device.
func (*Recorder) BeginTrace ¶
BeginTrace initializes a trace on a specific IP. Triggers sending of 302 probes and recording responses.
type Server ¶
Server contains the state of the active server
func (*Server) EndHandler ¶
func (s *Server) EndHandler(w http.ResponseWriter, r *http.Request)
EndHandler finishes traces
func (*Server) ErrorHandler ¶
func (s *Server) ErrorHandler(w http.ResponseWriter, r *http.Request)
ErrorHandler prints a standard message when errors are encountered
func (*Server) ProbeHandler ¶
func (s *Server) ProbeHandler(w http.ResponseWriter, r *http.Request)
ProbeHandler waits for probes to be received, then prints state.
func (*Server) StartHandler ¶
func (s *Server) StartHandler(w http.ResponseWriter, r *http.Request)
StartHandler triggers the start of traces.