1
0
mirror of https://github.com/nitezs/sub2clash.git synced 2024-12-23 10:34:42 -05:00

🎨 Refactor package for public import

This commit is contained in:
Nite07 2024-09-17 13:10:13 +08:00
parent 3cfa4bdf24
commit e504a6cca4
21 changed files with 67 additions and 49 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"
)

View File

@ -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"
)

View File

@ -5,7 +5,7 @@ import (
"errors"
"path/filepath"
"sub2clash/model"
"github.com/nitezs/sub2clash/model"
"go.etcd.io/bbolt"
)

View File

@ -3,8 +3,9 @@ package common
import (
"errors"
"net/http"
"sub2clash/config"
"time"
"github.com/nitezs/sub2clash/config"
)
type GetConfig struct {

View File

@ -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"
)

View File

@ -3,7 +3,8 @@ package common
import (
"fmt"
"strings"
"sub2clash/model"
"github.com/nitezs/sub2clash/model"
)
func PrependRuleProvider(

View File

@ -8,9 +8,10 @@ import (
"net/http"
"os"
"path/filepath"
"sub2clash/config"
"sync"
"time"
"github.com/nitezs/sub2clash/config"
)
var subsDir = "subs"

View File

@ -3,7 +3,8 @@ package common
import (
"os"
"path/filepath"
"sub2clash/config"
"github.com/nitezs/sub2clash/config"
)
func writeTemplate(path string, template string) error {

2
go.mod
View File

@ -1,4 +1,4 @@
module sub2clash
module github.com/nitezs/sub2clash
go 1.21

11
main.go
View File

@ -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"

View File

@ -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"
)

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {