-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstructures.go
More file actions
35 lines (29 loc) · 918 Bytes
/
structures.go
File metadata and controls
35 lines (29 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package extcap
import (
"fmt"
)
// extcap {version=0.1.0}{help=<some help or URL}
func versionString(ver string, help string) string {
return fmt.Sprintf("extcap {version=%s}{help=%s}", ver, help)
}
// Interface represents single network interface for capture
type Interface struct {
Value string
Display string
}
// Format to string in format
// interface {value=example1}{display=Example interface 1 for extcap}
func (iface Interface) marshal() string {
return fmt.Sprintf("interface {value=%s}{display=%s}", iface.Value, iface.Display)
}
// LinkType represents link type supported by interface
type LinkType struct {
Number int
Name string
Display string
}
// Format to string in format
// dlt {number=147}{name=USER1}{display=Demo Implementation for Extcap}
func (dlt LinkType) marshal() string {
return fmt.Sprintf("dlt {number=%d}{name=%s}{display=%s}", dlt.Number, dlt.Name, dlt.Display)
}