blob: 68900b0e05f27f18721e37537eb0370c0810388b [file] [log] [blame]
giolekva3c0e1822021-03-15 00:08:44 +04001package engine
2
3import (
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.
12type 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}