2022-06-11 01:34:30 +00:00
|
|
|
package portforward
|
|
|
|
|
|
2023-09-23 11:46:14 +00:00
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"net/netip"
|
|
|
|
|
)
|
2023-09-23 12:57:12 +02:00
|
|
|
|
|
|
|
|
type Service interface {
|
|
|
|
|
Start(ctx context.Context) (runError <-chan error, err error)
|
|
|
|
|
Stop() (err error)
|
2024-07-28 19:49:45 +00:00
|
|
|
GetPortsForwarded() (ports []uint16)
|
2023-09-23 12:57:12 +02:00
|
|
|
}
|
2022-06-11 01:34:30 +00:00
|
|
|
|
2023-09-23 11:46:14 +00:00
|
|
|
type Routing interface {
|
|
|
|
|
VPNLocalGatewayIP(vpnInterface string) (gateway netip.Addr, err error)
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-11 01:34:30 +00:00
|
|
|
type PortAllower interface {
|
|
|
|
|
SetAllowedPort(ctx context.Context, port uint16, intf string) (err error)
|
|
|
|
|
RemoveAllowedPort(ctx context.Context, port uint16) (err error)
|
2023-11-10 17:21:35 +00:00
|
|
|
RedirectPort(ctx context.Context, intf string, sourcePort,
|
|
|
|
|
destinationPort uint16) (err error)
|
2022-06-11 01:34:30 +00:00
|
|
|
}
|
2023-09-23 12:57:12 +02:00
|
|
|
|
|
|
|
|
type Logger interface {
|
2023-09-26 13:48:45 +00:00
|
|
|
Debug(s string)
|
2023-09-23 12:57:12 +02:00
|
|
|
Info(s string)
|
|
|
|
|
Warn(s string)
|
|
|
|
|
Error(s string)
|
|
|
|
|
}
|