Documentation ¶
Overview ¶
Package scamper is a library to work with scamper control sockets
Package scamper is a library to work with scamper control sockets ¶
Package scamper is a library to work with scamper control sockets ¶
Package scamper is a library to work with scamper control sockets
Index ¶
- Constants
- Variables
- func GetProc(sockDir, scampPort, scamperPath string) *proc.Process
- func GetVPProc(scpath, host, port string) *proc.Process
- func ParseConfig(sc Config) error
- type Client
- func (c *Client) AddSocket(s *Socket)
- func (c *Client) DoMeasurement(addr string, arg interface{}) (<-chan Response, uint32, error)
- func (c *Client) GetAllSockets() <-chan *Socket
- func (c *Client) GetSocket(addr string) (*Socket, error)
- func (c *Client) RemoveMeasurement(addr string, id uint32) error
- func (c *Client) RemoveSocket(addr string)
- type Cmd
- type Config
- type Response
- type Socket
Constants ¶
const ( // IPv4 Mode IPv4 = "-4" // IPv6 Mode IPv6 = "-6" // PORT to use PORT = "-P" // SOCKETDIR The Socket directory SOCKETDIR = "-U" // REMOTE Flag REMOTE = "-R" // SUDO the cmd must be run with sudo SUDO = "/usr/bin/sudo" // ADDRINDEX is the index of the addr arg ADDRINDEX = 2 // PPS is the packet per second rate of the scamper process PPS = "-p" )
Options for the scamper process
Variables ¶
var ( // ErrorBadDataResponse is returned when the data received by scamper couldnt // be converted ErrorBadDataResponse = errors.New("Bad DATA Response") // ErrorBadOKResponse is returned when an OK response fails to parse ErrorBadOKResponse = errors.New("Bad OK Response") // ErrorBadResponse is the generic error when a response can't be parsed ErrorBadResponse = errors.New("Bad Response") // ErrorTimeout returned when a command times out ErrorTimeout = errors.New("Timeout") )
var ( // ErrorCmdNotFound returned when no cmd is found in the cmdMap ErrorCmdNotFound = fmt.Errorf("No command found matching given Id") // ErrorDupCommand returned when a socket as a cmd with the same id already // running ErrorDupCommand = fmt.Errorf("Command already exists with the give Id") )
var ( // ErrSocketClosed is returned when the socket is closed ErrSocketClosed = fmt.Errorf("Socket closed.") // ErrFailedToIssueCmd is returned when issueCmd fails ErrFailedToIssueCmd = fmt.Errorf("Error issuing command.") )
var ( // ErrorSocketNotFound is used when a socketMap doesn't contain a socket ErrorSocketNotFound = fmt.Errorf("No socket found") )
Functions ¶
func ParseConfig ¶
ParseConfig checks the given confiuration options to ensure validity
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main object for interacting with scamper
func (*Client) DoMeasurement ¶
DoMeasurement run the measurement described by arg from the address addr
func (*Client) GetAllSockets ¶
GetAllSockets gets all the sockets
func (*Client) RemoveMeasurement ¶
RemoveMeasurement removes a measurement
func (*Client) RemoveSocket ¶
RemoveSocket removes a socket from the client
type Cmd ¶
type Cmd struct { ID uint32 Arg interface{} // contains filtered or unexported fields }
Cmd is a command that can run on scamper
type Response ¶
type Response struct { RType responseT Data []byte Ret interface{} DS int UserID uint32 Err error Header bool }
Response represents a response from scamper
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
Socket represents a scamper control socket
func (*Socket) DoMeasurement ¶
DoMeasurement perform the measurement described by arg
func (*Socket) Done ¶
func (s *Socket) Done() <-chan struct{}
Done indicates when the socket is closed
func (*Socket) RemoveMeasurement ¶
RemoveMeasurement remove a measurment being run with id id