mirror of
https://github.com/bettercap/bettercap.git
synced 2025-03-12 04:36:03 -07:00
28 lines
599 B
Go
28 lines
599 B
Go
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)
|
|
}
|