mirror of
https://github.com/fosrl/olm.git
synced 2026-02-08 05:56:41 +00:00
@@ -74,6 +74,9 @@ var (
|
|||||||
tunnelRunning bool
|
tunnelRunning bool
|
||||||
sharedBind *bind.SharedBind
|
sharedBind *bind.SharedBind
|
||||||
holePunchManager *holepunch.Manager
|
holePunchManager *holepunch.Manager
|
||||||
|
peerMonitor *peermonitor.PeerMonitor
|
||||||
|
stopRegister func()
|
||||||
|
stopPing chan struct{}
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(ctx context.Context, config Config) {
|
func Run(ctx context.Context, config Config) {
|
||||||
@@ -432,6 +435,7 @@ func TunnelProcess(ctx context.Context, config Config, id string, secret string,
|
|||||||
if err = dev.Up(); err != nil {
|
if err = dev.Up(); err != nil {
|
||||||
logger.Error("Failed to bring up WireGuard device: %v", err)
|
logger.Error("Failed to bring up WireGuard device: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = ConfigureInterface(interfaceName, wgData); err != nil {
|
if err = ConfigureInterface(interfaceName, wgData); err != nil {
|
||||||
logger.Error("Failed to configure interface: %v", err)
|
logger.Error("Failed to configure interface: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
20
olm/types.go
20
olm/types.go
@@ -1,7 +1,5 @@
|
|||||||
package olm
|
package olm
|
||||||
|
|
||||||
import "github.com/fosrl/olm/peermonitor"
|
|
||||||
|
|
||||||
type WgData struct {
|
type WgData struct {
|
||||||
Sites []SiteConfig `json:"sites"`
|
Sites []SiteConfig `json:"sites"`
|
||||||
TunnelIP string `json:"tunnelIP"`
|
TunnelIP string `json:"tunnelIP"`
|
||||||
@@ -16,15 +14,6 @@ type SiteConfig struct {
|
|||||||
RemoteSubnets string `json:"remoteSubnets,omitempty"` // optional, comma-separated list of subnets that this site can access
|
RemoteSubnets string `json:"remoteSubnets,omitempty"` // optional, comma-separated list of subnets that this site can access
|
||||||
}
|
}
|
||||||
|
|
||||||
type TargetsByType struct {
|
|
||||||
UDP []string `json:"udp"`
|
|
||||||
TCP []string `json:"tcp"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type TargetData struct {
|
|
||||||
Targets []string `json:"targets"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type HolePunchMessage struct {
|
type HolePunchMessage struct {
|
||||||
NewtID string `json:"newtId"`
|
NewtID string `json:"newtId"`
|
||||||
}
|
}
|
||||||
@@ -44,15 +33,6 @@ type EncryptedHolePunchMessage struct {
|
|||||||
Ciphertext []byte `json:"ciphertext"`
|
Ciphertext []byte `json:"ciphertext"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
peerMonitor *peermonitor.PeerMonitor
|
|
||||||
stopHolepunch chan struct{}
|
|
||||||
stopRegister func()
|
|
||||||
stopPing chan struct{}
|
|
||||||
olmToken string
|
|
||||||
holePunchRunning bool
|
|
||||||
)
|
|
||||||
|
|
||||||
// PeerAction represents a request to add, update, or remove a peer
|
// PeerAction represents a request to add, update, or remove a peer
|
||||||
type PeerAction struct {
|
type PeerAction struct {
|
||||||
Action string `json:"action"` // "add", "update", or "remove"
|
Action string `json:"action"` // "add", "update", or "remove"
|
||||||
|
|||||||
Reference in New Issue
Block a user