Skip to content

Commit

Permalink
move common proxy to CasaOS-Common (IceWhaleTech#643)
Browse files Browse the repository at this point in the history
...and use gateway proxy from CasaOS-Common
  • Loading branch information
tigerinus authored Oct 28, 2022
1 parent f210f29 commit 0fb5cab
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 218 deletions.
86 changes: 0 additions & 86 deletions common/notify.go

This file was deleted.

29 changes: 0 additions & 29 deletions common/notify_test.go

This file was deleted.

78 changes: 0 additions & 78 deletions common/share.go

This file was deleted.

14 changes: 0 additions & 14 deletions common/share_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
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.3.7-1
github.com/IceWhaleTech/CasaOS-Gateway v0.3.6
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/ambelovsky/go-structs v1.1.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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/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-20220929035515-b1287110d6d8 h1:r8nhgQ6tnrn6ikXN9aLH/K4H4H64Nc0hZ6jyW2B22x0=
github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220929035515-b1287110d6d8/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk=
github.com/IceWhaleTech/CasaOS-Common v0.3.7-1 h1:paay9dFGAWjNcjtCrN6ymvuU21KtxPoIpNG3wo10ufk=
github.com/IceWhaleTech/CasaOS-Common v0.3.7-1/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk=
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/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path/filepath"
"time"

"github.com/IceWhaleTech/CasaOS-Gateway/common"
"github.com/IceWhaleTech/CasaOS-Common/model"
"github.com/IceWhaleTech/CasaOS/model/notify"
"github.com/IceWhaleTech/CasaOS/pkg/cache"
"github.com/IceWhaleTech/CasaOS/pkg/config"
Expand Down Expand Up @@ -112,7 +112,7 @@ func main() {
}
routers := []string{"sys", "apps", "container", "app-categories", "port", "file", "folder", "batch", "image", "samba", "notify"}
for _, v := range routers {
err = service.MyService.Gateway().CreateRoute(&common.Route{
err = service.MyService.Gateway().CreateRoute(&model.Route{
Path: "/v1/" + v,
Target: "http://" + listener.Addr().String(),
})
Expand All @@ -126,7 +126,7 @@ func main() {
time.Sleep(time.Second * 2)
// v0.3.6
if config.ServerInfo.HttpPort != "" {
changePort := common.ChangePortRequest{}
changePort := model.ChangePortRequest{}
changePort.Port = config.ServerInfo.HttpPort
err := service.MyService.Gateway().ChangePort(&changePort)
if err == nil {
Expand Down
10 changes: 5 additions & 5 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package service

import (
gateway "github.com/IceWhaleTech/CasaOS-Gateway/common"
"github.com/IceWhaleTech/CasaOS-Common/external"
"github.com/gorilla/websocket"
"github.com/patrickmn/go-cache"
"gorm.io/gorm"
Expand All @@ -35,12 +35,12 @@ type Repository interface {
System() SystemService
Shares() SharesService
Connections() ConnectionsService
Gateway() gateway.ManagementService
Gateway() external.ManagementService
}

func NewService(db *gorm.DB, RuntimePath string) Repository {

gatewayManagement, err := gateway.NewManagementService(RuntimePath)
gatewayManagement, err := external.NewManagementService(RuntimePath)
if err != nil && len(RuntimePath) > 0 {
panic(err)
}
Expand Down Expand Up @@ -68,10 +68,10 @@ type store struct {
system SystemService
shares SharesService
connections ConnectionsService
gateway gateway.ManagementService
gateway external.ManagementService
}

func (c *store) Gateway() gateway.ManagementService {
func (c *store) Gateway() external.ManagementService {
return c.gateway
}
func (s *store) Connections() ConnectionsService {
Expand Down

0 comments on commit 0fb5cab

Please sign in to comment.