Skip to content

Commit

Permalink
Update rule-set usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Dec 4, 2023
1 parent 7b128b1 commit fb9bb6b
Show file tree
Hide file tree
Showing 6 changed files with 305 additions and 25 deletions.
34 changes: 23 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@ NAME = serenity
COMMIT = $(shell git rev-parse --short HEAD)
TAGS ?= with_acme

PARAMS = -v -trimpath -tags "$(TAGS)" -ldflags "-s -w -buildid="

PARAMS = -v -trimpath -ldflags "-s -w -buildid="
MAIN_PARAMS = $(PARAMS) -tags $(TAGS)
MAIN = ./cmd/serenity
PREFIX ?= $(shell go env GOPATH)

.PHONY: test release
.PHONY: release docs

build:
go build $(PARAMS) $(MAIN)
go build $(MAIN_PARAMS) $(MAIN)

install:
go build -o $(PREFIX)/bin/$(NAME) $(PARAMS) $(MAIN)
go build -o $(PREFIX)/bin/$(NAME) $(MAIN_PARAMS) $(MAIN)

fmt:
@gofumpt -l -w .
@gofmt -s -w .
@gci write --custom-order -s "standard,prefix(github.com/sagernet/),default" .
@gci write --custom-order -s standard -s "prefix(github.com/sagernet/)" -s "default" .

fmt_install:
go install -v mvdan.cc/gofumpt@latest
Expand All @@ -34,20 +36,30 @@ lint_install:
go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest

release:
goreleaser release --rm-dist --skip-publish || exit 1
go run ./cmd/internal/build goreleaser release --clean --skip-publish || exit 1
mkdir dist/release
mv dist/*.tar.gz dist/*.zip dist/*.deb dist/*.rpm dist/release
ghr --delete --draft --prerelease -p 3 $(shell git describe --tags) dist/release
rm -r dist
mv dist/*.tar.gz dist/*.zip dist/*.deb dist/*.rpm dist/*.pkg.tar.zst dist/release
ghr --replace --draft --prerelease -p 3 "v${VERSION}" dist/release
rm -r dist/release

release_install:
go install -v github.com/goreleaser/goreleaser@latest
go install -v github.com/tcnksm/ghr@latest
clean:

docs:
mkdocs serve

publish_docs:
mkdocs gh-deploy -m "Update" --force --ignore-version --no-history

docs_install:
pip install --force-reinstall mkdocs-material=="9.*" mkdocs-static-i18n=="1.2.*"

clean:
rm -rf bin dist serenity
rm -f $(shell go env GOPATH)/serenity

update:
git fetch
git reset FETCH_HEAD --hard
git clean -fdx
git clean -fdx
4 changes: 2 additions & 2 deletions cmd/serenity/command_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"runtime/debug"
"syscall"

"github.com/spf13/cobra"

"github.com/sagernet/serenity"
"github.com/sagernet/sing-box/log"

"github.com/spf13/cobra"
)

var configPath string
Expand Down
4 changes: 2 additions & 2 deletions cmd/serenity/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
"github.com/spf13/cobra"

"github.com/sagernet/sing-box/log"

"github.com/spf13/cobra"
)

var command = &cobra.Command{
Expand Down
12 changes: 6 additions & 6 deletions libsubscription/subscription_clash.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package libsubscription
import (
"strings"

"github.com/Dreamacro/clash/adapter"
clash_outbound "github.com/Dreamacro/clash/adapter/outbound"
"github.com/Dreamacro/clash/common/structure"
"github.com/Dreamacro/clash/config"
"github.com/Dreamacro/clash/constant"

C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/format"
N "github.com/sagernet/sing/common/network"

"github.com/Dreamacro/clash/adapter"
clash_outbound "github.com/Dreamacro/clash/adapter/outbound"
"github.com/Dreamacro/clash/common/structure"
"github.com/Dreamacro/clash/config"
"github.com/Dreamacro/clash/constant"
)

func ParseClashSubscription(content string) ([]Server, error) {
Expand Down
6 changes: 3 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import (
"strings"
"time"

"github.com/go-chi/chi/v5"
"golang.org/x/net/http2"

"github.com/sagernet/sing-box"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/common/tls"
Expand All @@ -22,6 +19,9 @@ import (
"github.com/sagernet/sing/common"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/logger"

"github.com/go-chi/chi/v5"
"golang.org/x/net/http2"
)

var _ adapter.Service = (*Server)(nil)
Expand Down
Loading

0 comments on commit fb9bb6b

Please sign in to comment.