Files
natpass/code/client/tunnel/mgr.go
2021-10-12 15:10:33 +08:00

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)
}