| giolekva | 3c0e182 | 2021-03-15 00:08:44 +0400 | [diff] [blame^] | 1 | package engine |
| 2 | |
| 3 | import ( |
| 4 | "inet.af/netaddr" |
| 5 | "tailscale.com/ipn/ipnstate" |
| 6 | |
| 7 | "github.com/giolekva/pcloud/core/vpn/types" |
| 8 | ) |
| 9 | |
| 10 | // Abstracts away communication with host OS needed to setup netfwork interfaces |
| 11 | // for VPN. |
| 12 | type Engine interface { |
| 13 | // Reconfigures local network interfaces in accordance to the given VPN |
| 14 | // layout. |
| 15 | Configure(netMap *types.NetworkMap) error |
| 16 | // Unique public discovery key of the current device. |
| 17 | DiscoKey() types.DiscoKey |
| 18 | // Unique public endpoint of the given device. |
| 19 | // Communication between devices happen throughs such endpoints |
| 20 | // instead of IP addresses. |
| 21 | DiscoEndpoint() string |
| 22 | // Sends ping to the given IP address and invokes callback with results. |
| 23 | Ping(ip netaddr.IP, cb func(*ipnstate.PingResult)) |
| 24 | } |