Add zertier (#1137)

Signed-off-by: link <a624669980@163.com>
This commit is contained in:
link 2023-05-26 17:45:18 +08:00 committed by GitHub
parent dda15b0821
commit c9617e583f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

@ -76,7 +76,6 @@ func copyHeaders(destination, source http.Header) {
} }
func CheckNetwork() { func CheckNetwork() {
//先获取所有已创建的网络 //先获取所有已创建的网络
respBody, err := httper.ZTGet("/controller/network") respBody, err := httper.ZTGet("/controller/network")
if err != nil { if err != nil {

View file

@ -13,7 +13,7 @@ import (
) )
func (s *CasaOS) SetZerotierNetworkStatus(ctx echo.Context, networkId string) error { func (s *CasaOS) SetZerotierNetworkStatus(ctx echo.Context, networkId string) error {
ip := `,"via":"10.147.20.256"` ip := `,"via":"10.147.19.0"`
status := ctx.Request().PostFormValue("status") status := ctx.Request().PostFormValue("status")
if status == "online" { if status == "online" {
ip = `` ip = ``
@ -34,7 +34,7 @@ func (s *CasaOS) SetZerotierNetworkStatus(ctx echo.Context, networkId string) er
via := gjson.GetBytes(res, "routes.0.via").Str via := gjson.GetBytes(res, "routes.0.via").Str
info.Id = utils.Ptr(gjson.GetBytes(res, "id").Str) info.Id = utils.Ptr(gjson.GetBytes(res, "id").Str)
info.Name = utils.Ptr(gjson.GetBytes(res, "name").Str) info.Name = utils.Ptr(gjson.GetBytes(res, "name").Str)
if len(via) != 0 { if len(via) == 0 {
info.Status = utils.Ptr("online") info.Status = utils.Ptr("online")
} else { } else {
info.Status = utils.Ptr("offline") info.Status = utils.Ptr("offline")