mirror of
https://github.com/lwch/natpass
synced 2025-10-30 15:06:17 +08:00
29 lines
414 B
Go
29 lines
414 B
Go
package tunnel
|
|
|
|
import "sync"
|
|
|
|
// Tunnel tunnel interface
|
|
type Tunnel interface {
|
|
GetName() string
|
|
GetTypeName() string
|
|
GetTarget() string
|
|
}
|
|
|
|
// Mgr tunnel manager
|
|
type Mgr struct {
|
|
sync.RWMutex
|
|
tunnels []Tunnel
|
|
}
|
|
|
|
// New new tunnel manager
|
|
func New() *Mgr {
|
|
return &Mgr{}
|
|
}
|
|
|
|
// Add add tunnel
|
|
func (mgr *Mgr) Add(tunnel Tunnel) {
|
|
mgr.Lock()
|
|
defer mgr.Unlock()
|
|
mgr.tunnels = append(mgr.tunnels, tunnel)
|
|
}
|