Skip to content

Commit

Permalink
🎨 Refactor package for public import
Browse files Browse the repository at this point in the history
  • Loading branch information
nitezs committed Sep 17, 2024
1 parent 3cfa4bd commit e504a6c
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 49 deletions.
7 changes: 4 additions & 3 deletions api/handler/clash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 6 additions & 5 deletions api/handler/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions api/handler/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions api/handler/short_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
7 changes: 4 additions & 3 deletions api/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion common/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"path/filepath"

"sub2clash/model"
"github.com/nitezs/sub2clash/model"

"go.etcd.io/bbolt"
)
Expand Down
3 changes: 2 additions & 1 deletion common/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package common
import (
"errors"
"net/http"
"sub2clash/config"
"time"

"github.com/nitezs/sub2clash/config"
)

type GetConfig struct {
Expand Down
9 changes: 5 additions & 4 deletions common/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
3 changes: 2 additions & 1 deletion common/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package common
import (
"fmt"
"strings"
"sub2clash/model"

"github.com/nitezs/sub2clash/model"
)

func PrependRuleProvider(
Expand Down
3 changes: 2 additions & 1 deletion common/sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"net/http"
"os"
"path/filepath"
"sub2clash/config"
"sync"
"time"

"github.com/nitezs/sub2clash/config"
)

var subsDir = "subs"
Expand Down
3 changes: 2 additions & 1 deletion common/write_default_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package common
import (
"os"
"path/filepath"
"sub2clash/config"

"github.com/nitezs/sub2clash/config"
)

func writeTemplate(path string, template string) error {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module sub2clash
module github.com/nitezs/sub2clash

go 1.21

Expand Down
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion middleware/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
5 changes: 3 additions & 2 deletions parser/hysteria.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions parser/hysteria2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions parser/shadowsocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions parser/shadowsocksr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions parser/trojan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions parser/vless.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions parser/vmess.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e504a6c

Please sign in to comment.