Skip to content

Commit

Permalink
chore: code format fix (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
DVKunion authored Jul 9, 2024
1 parent c397054 commit b3f9002
Show file tree
Hide file tree
Showing 17 changed files with 149 additions and 205 deletions.
2 changes: 1 addition & 1 deletion .github/conf/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ builds:
- 6
- 7
ldflags:
- -s -w -X github.com/DVKunion/SeaMoon/pkg/system/xlog.Version={{.Version}} -X github.com/DVKunion/SeaMoon/pkg/system/xlog.Commit={{.ShortCommit}}
- -s -w -X github.com/DVKunion/SeaMoon/pkg/system/version.Version={{.Version}} -X github.com/DVKunion/SeaMoon/pkg/system/version.Commit={{.ShortCommit}}
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Build
run: |
go mod tidy
go build -o seamoon -v --ldflags "-s -w -X github.com/DVKunion/SeaMoon/pkg/system/xlog.Version=${{github.ref_name}} -X github.com/DVKunion/SeaMoon/pkg/system/xlog.Commit=${{github.sha}}" cmd/main.go
go build -o seamoon -v --ldflags "-s -w -X github.com/DVKunion/SeaMoon/pkg/system/version.Version=${{github.ref_name}} -X github.com/DVKunion/SeaMoon/pkg/system/version.Commit=${{github.sha}}" cmd/main.go
- uses: actions/upload-artifact@v4
with:
path: seamoon
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /src
ENV CGO_ENABLED 0
ENV VERSION=${VERSION}
ENV SHA=${SHA}
RUN go build -v -ldflags "-X github.com/DVKunion/SeaMoon/pkg/system/xlog.Version=${VERSION} -X github.com/DVKunion/SeaMoon/pkg/system/xlog.Commit=${SHA}" -o /tmp/seamoon cmd/main.go
RUN go build -v -ldflags "-X github.com/DVKunion/SeaMoon/pkg/system/version.Version=${VERSION} -X github.com/DVKunion/SeaMoon/pkg/system/version.Commit=${SHA}" -o /tmp/seamoon cmd/main.go
RUN chmod +x /tmp/seamoon
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \
apk add upx && upx -9 /tmp/seamoon
Expand Down
3 changes: 2 additions & 1 deletion cmd/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/DVKunion/SeaMoon/cmd/client/static"
"github.com/DVKunion/SeaMoon/pkg/api/service"
"github.com/DVKunion/SeaMoon/pkg/api/signal"
"github.com/DVKunion/SeaMoon/pkg/system/version"
"github.com/DVKunion/SeaMoon/pkg/system/xlog"
)

Expand Down Expand Up @@ -44,7 +45,7 @@ func runApi(ctx context.Context, debug bool) {

xlog.Info(xlog.ApiServiceStart, "addr", addr.Value, "port", port.Value)

if xlog.Version != "dev" || !debug {
if version.Version != "dev" || !debug {
gin.SetMode(gin.ReleaseMode)
}

Expand Down
20 changes: 15 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/DVKunion/SeaMoon/cmd/client"
"github.com/DVKunion/SeaMoon/cmd/server"
"github.com/DVKunion/SeaMoon/pkg/api/database/drivers"
"github.com/DVKunion/SeaMoon/pkg/system/xlog"
"github.com/DVKunion/SeaMoon/pkg/system/version"
)

var (
Expand All @@ -28,9 +28,14 @@ var (
RunE: Server,
}

proxyCommand = &cobra.Command{
clientCommand = &cobra.Command{
Use: "client",
Short: "SeaMoon client mod",
}

clientWebCommand = &cobra.Command{
Use: "web",
Short: "SeaMoon client web mod",
Run: Client,
}

Expand All @@ -44,7 +49,10 @@ var (
Use: "version",
Short: "SeaMoon version info",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(xlog.Version)
fmt.Println("SeaMoon Powered By DVK")
fmt.Printf("Version: %s\n", version.Version)
fmt.Printf("Commit: %s\n", version.Commit)
fmt.Printf("V2rayCoreVersion: %s\n", version.V2rayCoreVersion)
},
}
)
Expand All @@ -69,16 +77,18 @@ func Server(cmd *cobra.Command, args []string) error {
}

func init() {
proxyCommand.Flags().BoolVarP(&debug, "debug", "d", false, "proxy detail log")
clientWebCommand.Flags().BoolVarP(&debug, "debug", "d", false, "proxy detail log")

serverCommand.Flags().StringVarP(&addr, "addr", "a", "0.0.0.0", "server listen addr")
serverCommand.Flags().StringVarP(&port, "port", "p", "9000", "server listen port")
serverCommand.Flags().StringVarP(&proto, "proto", "t", "websocket", "server listen proto: (websocket/grpc)")

rootCommand.AddCommand(versionCommand)
rootCommand.AddCommand(proxyCommand)
rootCommand.AddCommand(clientCommand)
rootCommand.AddCommand(serverCommand)
rootCommand.AddCommand(generateCommand)

clientCommand.AddCommand(clientWebCommand)
}

func main() {
Expand Down
61 changes: 19 additions & 42 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cam v1.0.866
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.866
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.866
github.com/v2fly/v2ray-core/v5 v5.15.1
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.33.0
github.com/v2fly/v2ray-core/v5 v5.16.1
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.34.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/gen v0.3.25
gorm.io/gorm v1.25.5
Expand All @@ -34,22 +34,17 @@ require (

require (
github.com/adrg/xdg v0.4.0 // indirect
github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
github.com/alibabacloud-go/openapi-util v0.1.0 // indirect
github.com/alibabacloud-go/tea-utils v1.3.1 // indirect
github.com/alibabacloud-go/tea-xml v1.1.3 // indirect
github.com/aliyun/credentials-go v1.3.1 // indirect
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/boljen/go-bitmap v0.0.0-20151001105940-23cd2fb0ce7d // indirect
github.com/bufbuild/protocompile v0.8.0 // indirect
github.com/bufbuild/protocompile v0.10.0 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/clbanning/mxj/v2 v2.5.5 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand All @@ -58,61 +53,46 @@ require (
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/glebarez/go-sqlite v1.21.2 // indirect
github.com/go-chi/chi/v5 v5.0.12 // indirect
github.com/go-chi/render v1.0.3 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jhump/protoreflect v1.15.6 // indirect
github.com/jhump/protoreflect v1.16.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/reedsolomon v1.11.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mustafaturan/bus v1.0.2 // indirect
github.com/mustafaturan/monoton v1.0.0 // indirect
github.com/onsi/ginkgo/v2 v2.13.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pion/dtls/v2 v2.2.7 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/sctp v1.8.7 // indirect
github.com/pion/transport/v2 v2.2.4 // indirect
github.com/pion/transport/v2 v2.2.5 // indirect
github.com/pires/go-proxyproto v0.7.0 // indirect
github.com/quic-go/quic-go v0.41.0 // indirect
github.com/refraction-networking/utls v1.6.3 // indirect
github.com/quic-go/quic-go v0.43.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/secure-io/siv-go v0.0.0-20180922214919-5ff40651e2c4 // indirect
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tjfoc/gmsm v1.3.2 // indirect
Expand All @@ -121,38 +101,35 @@ require (
github.com/v2fly/BrowserBridge v0.0.0-20210430233438-0570fc1d7d08 // indirect
github.com/v2fly/VSign v0.0.0-20201108000810-e2adc24bf848 // indirect
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e // indirect
github.com/vincent-petithory/dataurl v1.0.0 // indirect
github.com/xiaokangwang/VLite v0.0.0-20220418190619-cff95160a432 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/xtaci/smux v1.5.24 // indirect
go.starlark.net v0.0.0-20230612165344-9532f5667272 // indirect
go.uber.org/mock v0.3.0 // indirect
go.uber.org/mock v0.4.0 // indirect
go4.org/netipx v0.0.0-20230303233057-f1b76eb4bb35 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.56.0 // indirect
gopkg.in/resty.v1 v1.12.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c // indirect
gorm.io/driver/mysql v1.5.2 // indirect
gorm.io/hints v1.1.0 // indirect
gvisor.dev/gvisor v0.0.0-20231020174304-b8a429915ff1 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
lukechampine.com/blake3 v1.2.1 // indirect
lukechampine.com/blake3 v1.3.0 // indirect
modernc.org/libc v1.22.5 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.5.0 // indirect
Expand Down
Loading

0 comments on commit b3f9002

Please sign in to comment.