Debian Codegraph @

firewall/redirection.go

raw symbols SCIP
1 package firewall
2
3 import "fmt"
4
5 type Redirection struct {
6 Interface string
7 Protocol string
8 SrcAddress string
9 SrcPort int
10 DstAddress string
11 DstPort int
12 }
13
14 func NewRedirection(iface string, proto string, port_from int, addr_to string, port_to int) *Redirection {
15 return &Redirection{
16 Interface: iface,
17 Protocol: proto,
18 SrcAddress: "",
19 SrcPort: port_from,
20 DstAddress: addr_to,
21 DstPort: port_to,
22 }
23 }
24
25 func (r Redirection) String() string {
26 return fmt.Sprintf("[%s] (%s) %s:%d -> %s:%d", r.Interface, r.Protocol, r.SrcAddress, r.SrcPort, r.DstAddress, r.DstPort)
27 }