chore: reformat code

This commit is contained in:
世界
2022-06-09 21:08:46 +08:00
parent 9a55213ddc
commit cd466f05d3
114 changed files with 159 additions and 185 deletions

View File

@@ -2,10 +2,10 @@ package common
import (
"fmt"
"github.com/Dreamacro/clash/component/geodata"
"github.com/Dreamacro/clash/component/geodata/router"
"strings"
"github.com/Dreamacro/clash/component/geodata"
"github.com/Dreamacro/clash/component/geodata/router"
"github.com/Dreamacro/clash/component/mmdb"
"github.com/Dreamacro/clash/component/resolver"
C "github.com/Dreamacro/clash/constant"

View File

@@ -2,13 +2,14 @@ package common
import (
"fmt"
_ "unsafe"
"github.com/Dreamacro/clash/component/geodata"
_ "github.com/Dreamacro/clash/component/geodata/memconservative"
"github.com/Dreamacro/clash/component/geodata/router"
_ "github.com/Dreamacro/clash/component/geodata/standard"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
_ "unsafe"
)
//go:linkname initGeoSite github.com/Dreamacro/clash/config.initGeoSite

View File

@@ -2,8 +2,9 @@ package common
import (
"fmt"
C "github.com/Dreamacro/clash/constant"
"strings"
C "github.com/Dreamacro/clash/constant"
)
type InType struct {

View File

@@ -1,8 +1,9 @@
package common
import (
C "github.com/Dreamacro/clash/constant"
"net/netip"
C "github.com/Dreamacro/clash/constant"
)
type IPSuffix struct {

View File

@@ -2,8 +2,9 @@ package common
import (
"fmt"
C "github.com/Dreamacro/clash/constant"
"strings"
C "github.com/Dreamacro/clash/constant"
)
type NetworkType struct {

View File

@@ -2,13 +2,14 @@ package common
import (
"fmt"
"runtime"
"strconv"
"strings"
"github.com/Dreamacro/clash/common/utils"
"github.com/Dreamacro/clash/component/process"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
"runtime"
"strconv"
"strings"
)
type Uid struct {

View File

@@ -2,9 +2,10 @@ package logic
import (
"fmt"
"strings"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/rules/common"
"strings"
)
type AND struct {

View File

@@ -2,11 +2,12 @@ package logic
import (
"fmt"
"github.com/Dreamacro/clash/common/collections"
C "github.com/Dreamacro/clash/constant"
"regexp"
"strings"
_ "unsafe"
"github.com/Dreamacro/clash/common/collections"
C "github.com/Dreamacro/clash/constant"
)
//go:linkname parseRule github.com/Dreamacro/clash/rules.ParseRule

View File

@@ -1,9 +1,10 @@
package logic
import (
"testing"
"github.com/Dreamacro/clash/constant"
"github.com/stretchr/testify/assert"
"testing"
)
func TestAND(t *testing.T) {

View File

@@ -2,6 +2,7 @@ package logic
import (
"fmt"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/rules/common"
)

View File

@@ -2,9 +2,10 @@ package logic
import (
"fmt"
"strings"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/rules/common"
"strings"
)
type OR struct {

View File

@@ -1,10 +1,11 @@
package provider
import (
"strings"
"github.com/Dreamacro/clash/component/trie"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
"strings"
)
type domainStrategy struct {

View File

@@ -3,17 +3,18 @@ package provider
import (
"bytes"
"crypto/md5"
P "github.com/Dreamacro/clash/constant/provider"
"github.com/Dreamacro/clash/log"
"io/ioutil"
"os"
"path/filepath"
"time"
P "github.com/Dreamacro/clash/constant/provider"
"github.com/Dreamacro/clash/log"
)
var (
fileMode os.FileMode = 0666
dirMode os.FileMode = 0755
fileMode os.FileMode = 0o666
dirMode os.FileMode = 0o755
)
type parser = func([]byte) (interface{}, error)

View File

@@ -2,13 +2,14 @@ package provider
import (
"fmt"
"time"
"github.com/Dreamacro/clash/adapter/provider"
"github.com/Dreamacro/clash/common/structure"
C "github.com/Dreamacro/clash/constant"
P "github.com/Dreamacro/clash/constant/provider"
RC "github.com/Dreamacro/clash/rules/common"
"github.com/Dreamacro/clash/rules/ruleparser"
"time"
)
type ruleProviderSchema struct {

View File

@@ -2,16 +2,15 @@ package provider
import (
"encoding/json"
"runtime"
"time"
C "github.com/Dreamacro/clash/constant"
P "github.com/Dreamacro/clash/constant/provider"
"gopkg.in/yaml.v3"
"runtime"
"time"
)
var (
ruleProviders = map[string]P.RuleProvider{}
)
var ruleProviders = map[string]P.RuleProvider{}
type ruleSetProvider struct {
*fetcher

View File

@@ -2,6 +2,7 @@ package provider
import (
"fmt"
C "github.com/Dreamacro/clash/constant"
P "github.com/Dreamacro/clash/constant/provider"
"github.com/Dreamacro/clash/rules/common"
@@ -38,6 +39,7 @@ func (rs *RuleSet) Payload() string {
func (rs *RuleSet) ShouldResolveIP() bool {
return !rs.noResolveIP && rs.getProviders().ShouldResolveIP()
}
func (rs *RuleSet) getProviders() P.RuleProvider {
if rs.ruleProvider == nil {
rp := RuleProviders()[rs.ruleProviderName]

View File

@@ -2,6 +2,7 @@ package ruleparser
import (
"fmt"
C "github.com/Dreamacro/clash/constant"
RC "github.com/Dreamacro/clash/rules/common"
)