mirror of
https://github.com/lwch/natpass.git
synced 2024-04-21 12:41:54 +00:00
修改隧道列表,增加远端名称字段
This commit is contained in:
@@ -15,15 +15,17 @@ func (db *Dashboard) Tunnels(w http.ResponseWriter, r *http.Request) {
|
||||
RecvPacket uint64 `json:"recv_packet"`
|
||||
}
|
||||
type item struct {
|
||||
Name string `json:"name"`
|
||||
Port uint16 `json:"port"`
|
||||
Type string `json:"type"`
|
||||
Links []link `json:"links"`
|
||||
Name string `json:"name"`
|
||||
Remote string `json:"remote"`
|
||||
Port uint16 `json:"port"`
|
||||
Type string `json:"type"`
|
||||
Links []link `json:"links"`
|
||||
}
|
||||
var ret []item
|
||||
db.mgr.Range(func(t tunnel.Tunnel) {
|
||||
var it item
|
||||
it.Name = t.GetName()
|
||||
it.Remote = t.GetRemote()
|
||||
it.Port = t.GetPort()
|
||||
it.Type = t.GetTypeName()
|
||||
for _, l := range t.GetLinks() {
|
||||
|
||||
@@ -13,6 +13,7 @@ type Link interface {
|
||||
// Tunnel tunnel interface
|
||||
type Tunnel interface {
|
||||
GetName() string
|
||||
GetRemote() string
|
||||
GetPort() uint16
|
||||
GetTypeName() string
|
||||
GetTarget() string
|
||||
|
||||
@@ -54,6 +54,11 @@ func (t *Tunnel) GetLinks() []tunnel.Link {
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetRemote get remote target name
|
||||
func (t *Tunnel) GetRemote() string {
|
||||
return t.cfg.Target
|
||||
}
|
||||
|
||||
// GetPort get listen port
|
||||
func (t *Tunnel) GetPort() uint16 {
|
||||
return t.cfg.LocalPort
|
||||
|
||||
@@ -55,6 +55,11 @@ func (shell *Shell) GetLinks() []tunnel.Link {
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetRemote get remote target name
|
||||
func (shell *Shell) GetRemote() string {
|
||||
return shell.cfg.Target
|
||||
}
|
||||
|
||||
// GetPort get listen port
|
||||
func (shell *Shell) GetPort() uint16 {
|
||||
return shell.cfg.LocalPort
|
||||
|
||||
Reference in New Issue
Block a user