sniffer

package
v0.0.0-...-2b55090 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Overview

Package sniffer parses the output of the ioctl hook.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() error

Init reads from nvproxy and sets up the supported ioctl maps.

Types

type Connection

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

Connection is a connection to the sniffer hook.

func (Connection) ReadHookOutput

func (c Connection) ReadHookOutput(ctx context.Context) *Results

ReadHookOutput reads the output of the ioctl hook until an EOF is reached.

func (*Connection) ReadIoctlProto

func (c *Connection) ReadIoctlProto(ctx context.Context) (*pb.Ioctl, error)

ReadIoctlProto reads a single ioctl proto from this connection. Our format is:

  • 8 byte little endian uint64 containing the size of the proto.
  • The proto bytes.

This should match the format in sniffer_bridge.h.

type Ioctl

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

Ioctl contains the parsed ioctl protobuf information.

func ParseIoctlOutput

func ParseIoctlOutput(ioctl *pb.Ioctl) (Ioctl, error)

ParseIoctlOutput parses an ioctl protobuf from the ioctl hook.

func (Ioctl) IsSupported

func (i Ioctl) IsSupported() bool

IsSupported returns true if the ioctl is supported by nvproxy.

func (Ioctl) String

func (i Ioctl) String() string

type Results

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

Results contains the list of unsupported ioctls.

func NewResults

func NewResults() *Results

NewResults creates a new Results object.

func (*Results) AddUnsupportedIoctl

func (r *Results) AddUnsupportedIoctl(ioctl Ioctl)

AddUnsupportedIoctl adds an unsupported ioctl to the results.

func (*Results) HasUnsupportedIoctl

func (r *Results) HasUnsupportedIoctl() bool

HasUnsupportedIoctl returns true if there are any unsupported ioctls.

func (*Results) Merge

func (r *Results) Merge(other *Results)

Merge merges the results from another Results object into this one.

func (*Results) String

func (r *Results) String() string

type Server

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

Server is a server that accepts connections from the sniffer hook. It reads ioctl protos from each connection and sends them to the results channel.

func NewServer

func NewServer() *Server

NewServer creates a new Server.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the address of the socket.

func (*Server) AllResults

func (s *Server) AllResults() *Results

AllResults blocks until all connections have closed and returns an aggregate of all the results.

func (*Server) Listen

func (s *Server) Listen() error

Listen opens a new socket server.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve opens a new socket server, continually accepts connections from the socket and reads ioctl protos from each connection. It blocks until the context is cancelled.

Jump to

Keyboard shortcuts

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