mirror of
https://github.com/luscis/openlan.git
synced 2025-10-17 22:40:38 +08:00
fea: discard l2tp, esp, and fabric support.
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
package v5
|
||||
|
||||
import (
|
||||
"github.com/luscis/openlan/cmd/api"
|
||||
"github.com/luscis/openlan/pkg/schema"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
type Esp struct {
|
||||
Cmd
|
||||
}
|
||||
|
||||
func (u Esp) Url(prefix, name string) string {
|
||||
if name == "" {
|
||||
return prefix + "/api/esp"
|
||||
} else {
|
||||
return prefix + "/api/esp/" + name
|
||||
}
|
||||
}
|
||||
|
||||
func (u Esp) Tmpl() string {
|
||||
return `# total {{ len . }}
|
||||
{{ps -16 "name"}} {{ps -16 "address"}}
|
||||
{{- range . }}
|
||||
{{ps -16 .Name}} {{ps -16 .Address}}
|
||||
{{- end }}
|
||||
`
|
||||
}
|
||||
|
||||
func (u Esp) List(c *cli.Context) error {
|
||||
url := u.Url(c.String("url"), "")
|
||||
clt := u.NewHttp(c.String("token"))
|
||||
var items []schema.Esp
|
||||
if err := clt.GetJSON(url, &items); err != nil {
|
||||
return err
|
||||
}
|
||||
return u.Out(items, c.String("format"), u.Tmpl())
|
||||
}
|
||||
|
||||
func (u Esp) Commands(app *api.App) {
|
||||
app.Command(&cli.Command{
|
||||
Name: "esp",
|
||||
Aliases: []string{"esp"},
|
||||
Usage: "IPSec ESP configuration",
|
||||
Subcommands: []*cli.Command{
|
||||
{
|
||||
Name: "list",
|
||||
Usage: "Display all esp",
|
||||
Aliases: []string{"ls"},
|
||||
Action: u.List,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user