Documentation
¶
Index ¶
- Constants
- Variables
- func AddTask(t *file.Tunnel) error
- func CanUpdateSelf() bool
- func DealBridgeTask()
- func DelClientConnect(clientId int)
- func DelTask(id int) error
- func DelTunnelAndHostByClientId(clientId int, justDelNoStore bool)
- func GetClientList(start, length int, search, sortField, order string, clientId int) (list []*file.Client, cnt int)
- func GetCurrentYear() int
- func GetDashboardData(force bool) map[string]interface{}
- func GetHostList(start, length, clientId int, search, sortField, order string) (list []*file.Host, cnt int)
- func GetMinVersion() string
- func GetTunnel(start, length int, typeVal string, clientId int, search string, ...) ([]*file.Tunnel, int)
- func GetVersion() string
- func InitDashboardData()
- func InitFromDb()
- func NewMode(Bridge *bridge.Bridge, c *file.Tunnel) proxy.Service
- func PingClient(id int, addr string) int
- func RequestClientUpdate(clientId int) (int, error)
- func SetWebHandler(handler http.Handler)
- func StartIPRegisterServer(handler http.Handler)
- func StartNewServer(cnf *file.Tunnel, bridgeDisconnect int)
- func StartTask(id int) error
- func StopServer(id int) error
- func UpdateSelf() (string, error)
- type WebServer
Constants ¶
const ServiceName = "Nps"
ServiceName is the name nps is installed as a system service under.
Variables ¶
var ( Bridge *bridge.Bridge RunList sync.Map //map[int]interface{} HttpProxyCache = index.NewAnyIntIndex() )
var ( // ErrUpdateDisabled is returned by UpdateSelf when remote update is off. ErrUpdateDisabled = errors.New("remote update is disabled") // ErrUpdateRunning is returned by UpdateSelf while an update runs. ErrUpdateRunning = errors.New("an update is already running") )
var DisableRemoteUpdate bool
DisableRemoteUpdate keeps the web interface from updating the server.
Functions ¶
func AddTask ¶
AddTask add task. Services that own a listening socket bind it before AddTask returns, so address errors are reported to the caller and a later StopServer always finds the running instance in RunList.
func CanUpdateSelf ¶ added in v0.34.9
func CanUpdateSelf() bool
CanUpdateSelf reports whether the web interface may update the server.
func DelTunnelAndHostByClientId ¶
DelTunnelAndHostByClientId delete all host and tasks by client id
func GetClientList ¶
func GetClientList(start, length int, search, sortField, order string, clientId int) (list []*file.Client, cnt int)
GetClientList get client list
func GetCurrentYear ¶
func GetCurrentYear() int
func GetDashboardData ¶
func GetHostList ¶ added in v0.26.50
func GetHostList(start, length, clientId int, search, sortField, order string) (list []*file.Host, cnt int)
GetHostList get client list
func GetMinVersion ¶ added in v0.29.3
func GetMinVersion() string
func GetVersion ¶
func GetVersion() string
func InitDashboardData ¶ added in v0.29.5
func InitDashboardData()
func PingClient ¶ added in v0.33.4
func RequestClientUpdate ¶ added in v0.34.9
RequestClientUpdate asks the connected npc of client clientId to update themselves; it returns how many were asked.
func SetWebHandler ¶ added in v0.34.8
func StartIPRegisterServer ¶ added in v0.34.9
StartIPRegisterServer serves handler, the registration page, to bridge://ipreg targets and, when the configuration sets ip_register_port, on a listener of its own.
func StartNewServer ¶
StartNewServer start a new server
func UpdateSelf ¶ added in v0.34.9
UpdateSelf updates the server to the latest release and restarts it shortly as the new version. It returns the version updated to, or "" when the running version is the latest.
Types ¶
type WebServer ¶ added in v0.32.2
type WebServer struct {
proxy.BaseServer
// contains filtered or unexported fields
}