-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
panels.go
45 lines (38 loc) · 1.07 KB
/
panels.go
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
36
37
38
39
40
41
42
43
44
45
package main
import (
"github.com/gdamore/tcell"
"github.com/sachaos/tview"
)
func preparePacketList() *tview.Table {
table := tview.NewTable().
SetBorders(false).
SetSeparator(tview.GraphicsVertBar)
table.SetTitle("Packets").
SetBackgroundColor(tcell.ColorDefault).
SetBorder(true)
columns := []string{"No.", "Time", "Flow", "Length", "Network", "Transport"}
for i, column := range columns {
table.SetCell(0, i,
tview.NewTableCell(column).
SetTextColor(tcell.ColorYellow).
SetSelectable(false),
)
}
table.SetFixed(1, 1)
return table
}
func preparePacketDetail() *tview.TextView {
text := tview.NewTextView()
text.SetBorder(true).SetTitle("Detail").SetBackgroundColor(tcell.ColorDefault)
return text
}
func preparePacketDump() *tview.TextView {
text := tview.NewTextView()
text.SetBorder(true).SetTitle("Dump").SetBackgroundColor(tcell.ColorDefault)
return text
}
func prepareFrame(primitive tview.Primitive) *tview.Frame {
frame := tview.NewFrame(primitive).SetBorders(0, 0, 0, 0, 0, 0)
frame.SetBackgroundColor(tcell.ColorDefault)
return frame
}