From e504a6cca43de619e4be25639f6f93583a73ee9a Mon Sep 17 00:00:00 2001 From: Nite07 Date: Tue, 17 Sep 2024 13:10:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Refactor=20package=20for=20publi?= =?UTF-8?q?c=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/handler/clash.go | 7 ++++--- api/handler/default.go | 11 ++++++----- api/handler/meta.go | 7 ++++--- api/handler/short_link.go | 10 +++++----- api/route.go | 7 ++++--- common/database/database.go | 2 +- common/get.go | 3 ++- common/proxy.go | 9 +++++---- common/rule.go | 3 ++- common/sub.go | 3 ++- common/write_default_template.go | 3 ++- go.mod | 2 +- main.go | 11 ++++++----- middleware/logger.go | 3 ++- parser/hysteria.go | 5 +++-- parser/hysteria2.go | 5 +++-- parser/shadowsocks.go | 5 +++-- parser/shadowsocksr.go | 5 +++-- parser/trojan.go | 5 +++-- parser/vless.go | 5 +++-- parser/vmess.go | 5 +++-- 21 files changed, 67 insertions(+), 49 deletions(-) diff --git a/api/handler/clash.go b/api/handler/clash.go index ea35537..82a0af2 100644 --- a/api/handler/clash.go +++ b/api/handler/clash.go @@ -2,9 +2,10 @@ package handler import ( "net/http" - "sub2clash/config" - "sub2clash/model" - "sub2clash/validator" + + "github.com/nitezs/sub2clash/config" + "github.com/nitezs/sub2clash/model" + "github.com/nitezs/sub2clash/validator" "github.com/gin-gonic/gin" "gopkg.in/yaml.v3" diff --git a/api/handler/default.go b/api/handler/default.go index 25ee8c9..7d3244c 100644 --- a/api/handler/default.go +++ b/api/handler/default.go @@ -9,11 +9,12 @@ import ( "sort" "strconv" "strings" - "sub2clash/common" - "sub2clash/logger" - "sub2clash/model" - "sub2clash/parser" - "sub2clash/validator" + + "github.com/nitezs/sub2clash/common" + "github.com/nitezs/sub2clash/logger" + "github.com/nitezs/sub2clash/model" + "github.com/nitezs/sub2clash/parser" + "github.com/nitezs/sub2clash/validator" "go.uber.org/zap" "gopkg.in/yaml.v3" diff --git a/api/handler/meta.go b/api/handler/meta.go index 4249acf..a697310 100644 --- a/api/handler/meta.go +++ b/api/handler/meta.go @@ -3,9 +3,10 @@ package handler import ( _ "embed" "net/http" - "sub2clash/config" - "sub2clash/model" - "sub2clash/validator" + + "github.com/nitezs/sub2clash/config" + "github.com/nitezs/sub2clash/model" + "github.com/nitezs/sub2clash/validator" "github.com/gin-gonic/gin" "gopkg.in/yaml.v3" diff --git a/api/handler/short_link.go b/api/handler/short_link.go index f410f33..0969b29 100644 --- a/api/handler/short_link.go +++ b/api/handler/short_link.go @@ -7,11 +7,11 @@ import ( "strings" "time" - "sub2clash/common" - "sub2clash/common/database" - "sub2clash/config" - "sub2clash/model" - "sub2clash/validator" + "github.com/nitezs/sub2clash/common" + "github.com/nitezs/sub2clash/common/database" + "github.com/nitezs/sub2clash/config" + "github.com/nitezs/sub2clash/model" + "github.com/nitezs/sub2clash/validator" "github.com/gin-gonic/gin" ) diff --git a/api/route.go b/api/route.go index 0861945..118738c 100644 --- a/api/route.go +++ b/api/route.go @@ -5,9 +5,10 @@ import ( "html/template" "log" "net/http" - "sub2clash/api/handler" - "sub2clash/constant" - "sub2clash/middleware" + + "github.com/nitezs/sub2clash/api/handler" + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/middleware" "github.com/gin-gonic/gin" ) diff --git a/common/database/database.go b/common/database/database.go index fe79c1c..638ea31 100644 --- a/common/database/database.go +++ b/common/database/database.go @@ -5,7 +5,7 @@ import ( "errors" "path/filepath" - "sub2clash/model" + "github.com/nitezs/sub2clash/model" "go.etcd.io/bbolt" ) diff --git a/common/get.go b/common/get.go index 7b46e1d..fd1de5e 100644 --- a/common/get.go +++ b/common/get.go @@ -3,8 +3,9 @@ package common import ( "errors" "net/http" - "sub2clash/config" "time" + + "github.com/nitezs/sub2clash/config" ) type GetConfig struct { diff --git a/common/proxy.go b/common/proxy.go index b8ffed2..b3c5e22 100644 --- a/common/proxy.go +++ b/common/proxy.go @@ -2,10 +2,11 @@ package common import ( "strings" - "sub2clash/constant" - "sub2clash/logger" - "sub2clash/model" - "sub2clash/parser" + + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/logger" + "github.com/nitezs/sub2clash/model" + "github.com/nitezs/sub2clash/parser" "go.uber.org/zap" ) diff --git a/common/rule.go b/common/rule.go index 6320c8f..a354335 100644 --- a/common/rule.go +++ b/common/rule.go @@ -3,7 +3,8 @@ package common import ( "fmt" "strings" - "sub2clash/model" + + "github.com/nitezs/sub2clash/model" ) func PrependRuleProvider( diff --git a/common/sub.go b/common/sub.go index d22bd38..4ef3652 100644 --- a/common/sub.go +++ b/common/sub.go @@ -8,9 +8,10 @@ import ( "net/http" "os" "path/filepath" - "sub2clash/config" "sync" "time" + + "github.com/nitezs/sub2clash/config" ) var subsDir = "subs" diff --git a/common/write_default_template.go b/common/write_default_template.go index 9342a3a..d3511f7 100644 --- a/common/write_default_template.go +++ b/common/write_default_template.go @@ -3,7 +3,8 @@ package common import ( "os" "path/filepath" - "sub2clash/config" + + "github.com/nitezs/sub2clash/config" ) func writeTemplate(path string, template string) error { diff --git a/go.mod b/go.mod index be09775..e0ec322 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module sub2clash +module github.com/nitezs/sub2clash go 1.21 diff --git a/main.go b/main.go index 33dd1ab..4aa8320 100644 --- a/main.go +++ b/main.go @@ -4,11 +4,12 @@ import ( _ "embed" "io" "strconv" - "sub2clash/api" - "sub2clash/common" - "sub2clash/common/database" - "sub2clash/config" - "sub2clash/logger" + + "github.com/nitezs/sub2clash/api" + "github.com/nitezs/sub2clash/common" + "github.com/nitezs/sub2clash/common/database" + "github.com/nitezs/sub2clash/config" + "github.com/nitezs/sub2clash/logger" "github.com/gin-gonic/gin" "go.uber.org/zap" diff --git a/middleware/logger.go b/middleware/logger.go index 649c4f1..10011e2 100644 --- a/middleware/logger.go +++ b/middleware/logger.go @@ -2,9 +2,10 @@ package middleware import ( "strconv" - "sub2clash/logger" "time" + "github.com/nitezs/sub2clash/logger" + "github.com/gin-gonic/gin" "go.uber.org/zap" ) diff --git a/parser/hysteria.go b/parser/hysteria.go index f0c6523..8a73045 100644 --- a/parser/hysteria.go +++ b/parser/hysteria.go @@ -5,8 +5,9 @@ import ( "net/url" "strconv" "strings" - "sub2clash/constant" - "sub2clash/model" + + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/model" ) func ParseHysteria(proxy string) (model.Proxy, error) { diff --git a/parser/hysteria2.go b/parser/hysteria2.go index 62d0d2c..ee005d4 100644 --- a/parser/hysteria2.go +++ b/parser/hysteria2.go @@ -4,8 +4,9 @@ import ( "fmt" "net/url" "strings" - "sub2clash/constant" - "sub2clash/model" + + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/model" ) func ParseHysteria2(proxy string) (model.Proxy, error) { diff --git a/parser/shadowsocks.go b/parser/shadowsocks.go index aca013d..bec376a 100644 --- a/parser/shadowsocks.go +++ b/parser/shadowsocks.go @@ -4,8 +4,9 @@ import ( "fmt" "net/url" "strings" - "sub2clash/constant" - "sub2clash/model" + + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/model" ) func ParseShadowsocks(proxy string) (model.Proxy, error) { diff --git a/parser/shadowsocksr.go b/parser/shadowsocksr.go index 68c9e06..8c9bace 100644 --- a/parser/shadowsocksr.go +++ b/parser/shadowsocksr.go @@ -4,8 +4,9 @@ import ( "net/url" "strconv" "strings" - "sub2clash/constant" - "sub2clash/model" + + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/model" ) func ParseShadowsocksR(proxy string) (model.Proxy, error) { diff --git a/parser/trojan.go b/parser/trojan.go index 09aac17..2ccdcec 100644 --- a/parser/trojan.go +++ b/parser/trojan.go @@ -4,8 +4,9 @@ import ( "fmt" "net/url" "strings" - "sub2clash/constant" - "sub2clash/model" + + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/model" ) func ParseTrojan(proxy string) (model.Proxy, error) { diff --git a/parser/vless.go b/parser/vless.go index bb418cf..935896e 100644 --- a/parser/vless.go +++ b/parser/vless.go @@ -4,8 +4,9 @@ import ( "fmt" "net/url" "strings" - "sub2clash/constant" - "sub2clash/model" + + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/model" ) func ParseVless(proxy string) (model.Proxy, error) { diff --git a/parser/vmess.go b/parser/vmess.go index 287e779..d6fe022 100644 --- a/parser/vmess.go +++ b/parser/vmess.go @@ -5,8 +5,9 @@ import ( "net/url" "strconv" "strings" - "sub2clash/constant" - "sub2clash/model" + + "github.com/nitezs/sub2clash/constant" + "github.com/nitezs/sub2clash/model" ) func ParseVmess(proxy string) (model.Proxy, error) {