File: redirection.go

package info (click to toggle)
bettercap 2.33.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,668 kB
  • sloc: sh: 154; makefile: 76; python: 52; ansic: 9
file content (27 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (2)
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
package firewall

import "fmt"

type Redirection struct {
	Interface  string
	Protocol   string
	SrcAddress string
	SrcPort    int
	DstAddress string
	DstPort    int
}

func NewRedirection(iface string, proto string, port_from int, addr_to string, port_to int) *Redirection {
	return &Redirection{
		Interface:  iface,
		Protocol:   proto,
		SrcAddress: "",
		SrcPort:    port_from,
		DstAddress: addr_to,
		DstPort:    port_to,
	}
}

func (r Redirection) String() string {
	return fmt.Sprintf("[%s] (%s) %s:%d -> %s:%d", r.Interface, r.Protocol, r.SrcAddress, r.SrcPort, r.DstAddress, r.DstPort)
}