This commit is contained in:
Tiger Wang 2022-10-28 16:57:00 -04:00
parent 8a5d642192
commit 057d62cdc0
4 changed files with 11 additions and 11 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.16
require ( require (
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d
github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220929035515-b1287110d6d8 github.com/IceWhaleTech/CasaOS-Common v0.0.0-20221028205031-b7c1d053db0b
github.com/IceWhaleTech/CasaOS-Gateway v0.3.6 github.com/IceWhaleTech/CasaOS-Gateway v0.3.6
github.com/Microsoft/go-winio v0.5.0 // indirect github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/ambelovsky/go-structs v1.1.0 // indirect github.com/ambelovsky/go-structs v1.1.0 // indirect

4
go.sum
View File

@ -84,8 +84,8 @@ github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d/go.mod h1:lW9x+yEjqKdPbE3+cf2fGPJXCw/hChX3Omi9QHTLFsQ= github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d/go.mod h1:lW9x+yEjqKdPbE3+cf2fGPJXCw/hChX3Omi9QHTLFsQ=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220901034123-ca130f6b5ce9/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk= github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220901034123-ca130f6b5ce9/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk=
github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220929035515-b1287110d6d8 h1:r8nhgQ6tnrn6ikXN9aLH/K4H4H64Nc0hZ6jyW2B22x0= github.com/IceWhaleTech/CasaOS-Common v0.0.0-20221028205031-b7c1d053db0b h1:HKdwfgoFQbq9OoGrTVuBug1fUFADER0hy6o2L/RsLKA=
github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220929035515-b1287110d6d8/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk= github.com/IceWhaleTech/CasaOS-Common v0.0.0-20221028205031-b7c1d053db0b/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk=
github.com/IceWhaleTech/CasaOS-Gateway v0.3.6 h1:2tQQo85+jzbbjqIsKKn77QlAA73bc7vZsVCFvWnK4mg= github.com/IceWhaleTech/CasaOS-Gateway v0.3.6 h1:2tQQo85+jzbbjqIsKKn77QlAA73bc7vZsVCFvWnK4mg=
github.com/IceWhaleTech/CasaOS-Gateway v0.3.6/go.mod h1:hnZwGUzcOyiufMpVO7l3gu2gAm6Ws4TY4Nlj3kMshXA= github.com/IceWhaleTech/CasaOS-Gateway v0.3.6/go.mod h1:hnZwGUzcOyiufMpVO7l3gu2gAm6Ws4TY4Nlj3kMshXA=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=

View File

@ -8,7 +8,7 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/IceWhaleTech/CasaOS-Gateway/common" "github.com/IceWhaleTech/CasaOS-Common/model"
"github.com/IceWhaleTech/CasaOS/model/notify" "github.com/IceWhaleTech/CasaOS/model/notify"
"github.com/IceWhaleTech/CasaOS/pkg/cache" "github.com/IceWhaleTech/CasaOS/pkg/cache"
"github.com/IceWhaleTech/CasaOS/pkg/config" "github.com/IceWhaleTech/CasaOS/pkg/config"
@ -112,7 +112,7 @@ func main() {
} }
routers := []string{"sys", "apps", "container", "app-categories", "port", "file", "folder", "batch", "image", "samba", "notify"} routers := []string{"sys", "apps", "container", "app-categories", "port", "file", "folder", "batch", "image", "samba", "notify"}
for _, v := range routers { for _, v := range routers {
err = service.MyService.Gateway().CreateRoute(&common.Route{ err = service.MyService.Gateway().CreateRoute(&model.Route{
Path: "/v1/" + v, Path: "/v1/" + v,
Target: "http://" + listener.Addr().String(), Target: "http://" + listener.Addr().String(),
}) })
@ -126,7 +126,7 @@ func main() {
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
// v0.3.6 // v0.3.6
if config.ServerInfo.HttpPort != "" { if config.ServerInfo.HttpPort != "" {
changePort := common.ChangePortRequest{} changePort := model.ChangePortRequest{}
changePort.Port = config.ServerInfo.HttpPort changePort.Port = config.ServerInfo.HttpPort
err := service.MyService.Gateway().ChangePort(&changePort) err := service.MyService.Gateway().ChangePort(&changePort)
if err == nil { if err == nil {

View File

@ -11,7 +11,7 @@
package service package service
import ( import (
gateway "github.com/IceWhaleTech/CasaOS-Gateway/common" "github.com/IceWhaleTech/CasaOS-Common/external"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"github.com/patrickmn/go-cache" "github.com/patrickmn/go-cache"
"gorm.io/gorm" "gorm.io/gorm"
@ -35,12 +35,12 @@ type Repository interface {
System() SystemService System() SystemService
Shares() SharesService Shares() SharesService
Connections() ConnectionsService Connections() ConnectionsService
Gateway() gateway.ManagementService Gateway() external.ManagementService
} }
func NewService(db *gorm.DB, RuntimePath string) Repository { func NewService(db *gorm.DB, RuntimePath string) Repository {
gatewayManagement, err := gateway.NewManagementService(RuntimePath) gatewayManagement, err := external.NewManagementService(RuntimePath)
if err != nil && len(RuntimePath) > 0 { if err != nil && len(RuntimePath) > 0 {
panic(err) panic(err)
} }
@ -68,10 +68,10 @@ type store struct {
system SystemService system SystemService
shares SharesService shares SharesService
connections ConnectionsService connections ConnectionsService
gateway gateway.ManagementService gateway external.ManagementService
} }
func (c *store) Gateway() gateway.ManagementService { func (c *store) Gateway() external.ManagementService {
return c.gateway return c.gateway
} }
func (s *store) Connections() ConnectionsService { func (s *store) Connections() ConnectionsService {