Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use release binary instead of self compiling #24

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.dll
*.so
*.dylib
*.tar.gz

# Test binary, built with `go test -c`
*.test
Expand Down
4 changes: 2 additions & 2 deletions cmd/client/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func listen(ctx context.Context, server net.Listener, pa string, pt tunnel.Type,
if err != nil {
slog.Error(consts.ACCEPT_ERROR, "err", err)
}
if srv, ok := service.Factory[pt]; ok {
destConn, err := srv.Conn(ctx, t, service.WithAddr(pa))
if srv, ok := service.Factory.Load(pt); ok {
destConn, err := srv.(service.Service).Conn(ctx, t, service.WithAddr(pa))
if err != nil {
slog.Error(consts.CONNECT_RMOET_ERROR, "err", err)
continue
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func New(opts ...Option) (*Server, error) {
}
}
// check
if srv, ok := service.Factory[s.opts.proto]; ok {
s.srv = srv
if srv, ok := service.Factory.Load(s.opts.proto); ok {
s.srv = srv.(service.Service)
}

if s.srv == nil {
Expand Down
5 changes: 3 additions & 2 deletions pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package service
import (
"context"
"net"
"sync"

"github.com/DVKunion/SeaMoon/pkg/transfer"
"github.com/DVKunion/SeaMoon/pkg/tunnel"
Expand All @@ -13,8 +14,8 @@ type Service interface {
Serve(ln net.Listener, srvOpt ...Option) error
}

var Factory = map[tunnel.Type]Service{}
var Factory = sync.Map{}

func register(t tunnel.Type, s Service) {
Factory[t] = s
Factory.Store(t, s)
}
4 changes: 2 additions & 2 deletions s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ vars:

actions:
pre-deploy:
- run: go mod tidy
- run: wget https://github.com/DVKunion/SeaMoon/releases/download/1.2.0-beta.1/SeaMoon_1.2.0-beta.1_linux_amd64.tar.gz
path: ./
- run: GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X github.com/DVKunion/SeaMoon/pkg/consts.Version=2.0.0-beta.1" -o seamoon cmd/main.go
- run: tar -zvxf SeaMoon_1.2.0-beta.1_linux_amd64.tar.gz
path: ./
- run: chmod +x seamoon
path: ./
Expand Down
Loading