package traffic
import "go.dedis.ch/dela/internal/traffic"
Index ¶
- Constants
- Variables
- func GenerateEventGraphviz(out io.Writer, traffics ...*Traffic)
- func GenerateItemsGraphviz(out io.Writer, withSend, withRcv bool, traffics ...*Traffic)
- func SaveEvents(path string) error
- func SaveItems(path string, withSend, withRcv bool) error
- type Event
- type Traffic
- func NewTraffic(src mino.Address, out io.Writer) *Traffic
- func (t *Traffic) Display(out io.Writer)
- func (t *Traffic) LogRecv(ctx context.Context, gateway mino.Address, pkt router.Packet)
- func (t *Traffic) LogRelay(to mino.Address)
- func (t *Traffic) LogRelayClosed(to mino.Address)
- func (t *Traffic) LogSend(ctx context.Context, gateway mino.Address, pkt router.Packet)
- func (t *Traffic) Save(path string, withSend, withRcv bool) error
- type Watcher
Constants ¶
const EnvVariable = "MINO_TRAFFIC"
EnvVariable is the name of the environment variable to enable the traffic.
Variables ¶
var ( // LogItems allows one to granularly say when items should be logged or not. // This is useful for example in an integration test where a specific part // raises a problem but the full graph would be too noisy. For that, one // can set LogItems = false and change it to true when needed. LogItems = true // LogEvent works the same as LogItems but for events. Note that in both // cases the varenv should be set. LogEvent = true )
var GlobalWatcher = Watcher{ // contains filtered or unexported fields }
GlobalWatcher can be used to watch for sent and received messages.
Functions ¶
func GenerateEventGraphviz ¶
GenerateEventGraphviz creates a graphviz representation of the events
func GenerateItemsGraphviz ¶
GenerateItemsGraphviz creates a graphviz representation of the items. One can generate a graphical representation with `dot -Tpdf graph.dot -o graph.pdf`
func SaveEvents ¶
SaveEvents saves all the events as a graph
func SaveItems ¶
SaveItems saves all the items as a graph
Types ¶
type Event ¶
Event defines the elements of a receive or sent event
type Traffic ¶
Traffic is used to keep track of packets Traffic in a server
func NewTraffic ¶
NewTraffic creates a new empty traffic recorder.
func (*Traffic) Display ¶
Display prints the current traffic to the writer.
func (*Traffic) LogRecv ¶
LogRecv records a packet received by the node. The sender is the gateway and the receiver the node.
func (*Traffic) LogRelay ¶
LogRelay records a new relay.
func (*Traffic) LogRelayClosed ¶
LogRelayClosed records the end of a relay.
func (*Traffic) LogSend ¶
LogSend records a packet sent by the node. It records the node address as the sender and the gateway as the receiver, while also recording the packet itself.
func (*Traffic) Save ¶
Save saves the items graph to the given address.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher defines an element to watch for sent and received messages.
func (*Watcher) WatchIns ¶
WatchIns returns a channel populated with received messages.
func (*Watcher) WatchOuts ¶
WatchOuts returns a channel populated with sent messages.
Source Files ¶
mod.go
- Version
- v0.1.0 (latest)
- Published
- Apr 10, 2024
- Platform
- linux/amd64
- Imports
- 16 packages
- Last checked
- 1 month ago –
Tools for package owners.