Skip to content

Commit

Permalink
[Style] Format style using gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
ClashDotNetX committed Dec 6, 2021
1 parent ed3743b commit b2ee604
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 24 deletions.
3 changes: 2 additions & 1 deletion adapter/outbound/vless.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ func NewVless(option VlessOption) (*Vless, error) {
}

func newVlessPacketConn(c net.Conn, addr net.Addr) *vlessPacketConn {
return &vlessPacketConn{Conn: c,
return &vlessPacketConn{
Conn: c,
rAddr: addr,
cache: make([]byte, 0, maxLength+2),
}
Expand Down
4 changes: 1 addition & 3 deletions component/trie/ipcidr_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package trie

import "errors"

var (
ErrorOverMaxValue = errors.New("the value don't over max value")
)
var ErrorOverMaxValue = errors.New("the value don't over max value")

type IpCidrNode struct {
Mark bool
Expand Down
3 changes: 2 additions & 1 deletion component/trie/ipcidr_trie.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package trie

import (
"github.com/Dreamacro/clash/log"
"net"

"github.com/Dreamacro/clash/log"
)

type IPV6 bool
Expand Down
1 change: 0 additions & 1 deletion constant/adapters.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ type ProxyAdapter interface {
// DialContext return a C.Conn with protocol which
// contains multiplexing-related reuse logic (if any)
DialContext(ctx context.Context, metadata *Metadata, opts ...dialer.Option) (Conn, error)

ListenPacketContext(ctx context.Context, metadata *Metadata, opts ...dialer.Option) (PacketConn, error)

// Unwrap extracts the proxy from a proxy-group. It returns nil when nothing to extract.
Expand Down
3 changes: 2 additions & 1 deletion hub/route/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package route

import (
"context"
ruleProvider "github.com/Dreamacro/clash/rule/provider"
"net/http"

ruleProvider "github.com/Dreamacro/clash/rule/provider"

"github.com/Dreamacro/clash/constant/provider"
"github.com/Dreamacro/clash/tunnel"

Expand Down
8 changes: 4 additions & 4 deletions rule/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
var processCache = cache.NewLRUCache(cache.WithAge(2), cache.WithSize(64))

type Process struct {
adapter string
process string
adapter string
process string
fullMatch bool
}

Expand Down Expand Up @@ -70,8 +70,8 @@ func NewProcess(process string, adapter string, fullMatch bool) (*Process, error
}

return &Process{
adapter: adapter,
process: process,
adapter: adapter,
process: process,
fullMatch: fullMatch,
}, nil
}
9 changes: 5 additions & 4 deletions rule/provider/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package provider
import (
"bytes"
"crypto/md5"
providerType "github.com/Dreamacro/clash/constant/provider"
"github.com/Dreamacro/clash/log"
"io/ioutil"
"os"
"path/filepath"
"time"

providerType "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)
Expand Down
3 changes: 2 additions & 1 deletion rule/provider/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package provider

import (
"fmt"
"time"

"github.com/Dreamacro/clash/adapter/provider"
"github.com/Dreamacro/clash/common/structure"
C "github.com/Dreamacro/clash/constant"
providerType "github.com/Dreamacro/clash/constant/provider"
"time"
)

type ruleProviderSchema struct {
Expand Down
7 changes: 4 additions & 3 deletions rule/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package provider
import (
"encoding/json"
"errors"
"runtime"
"strings"
"time"

"github.com/Dreamacro/clash/component/trie"
C "github.com/Dreamacro/clash/constant"
providerType "github.com/Dreamacro/clash/constant/provider"
"gopkg.in/yaml.v2"
"runtime"
"strings"
"time"
)

type Behavior int
Expand Down
7 changes: 4 additions & 3 deletions rule/provider_test/provider_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package provider_test

import (
"net"
"testing"
"time"

"github.com/Dreamacro/clash/adapter/provider"
"github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/rule"
ruleProvider "github.com/Dreamacro/clash/rule/provider"
"github.com/stretchr/testify/assert"
"net"
"testing"
"time"
)

func setup() {
Expand Down
2 changes: 2 additions & 0 deletions rule/rule_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rules

import (
"fmt"

C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/rule/provider"
)
Expand Down Expand Up @@ -31,6 +32,7 @@ func (rs *RuleSet) Payload() string {
func (rs *RuleSet) ShouldResolveIP() bool {
return rs.getProviders().Behavior() != provider.Domain
}

func (rs *RuleSet) getProviders() provider.RuleProvider {
if rs.ruleProvider == nil {
rp := provider.RuleProviders()[rs.ruleProviderName]
Expand Down
3 changes: 2 additions & 1 deletion tunnel/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package tunnel
import (
"context"
"fmt"
ruleProvider "github.com/Dreamacro/clash/rule/provider"
"net"
"runtime"
"sync"
"time"

ruleProvider "github.com/Dreamacro/clash/rule/provider"

"github.com/Dreamacro/clash/adapter/inbound"
"github.com/Dreamacro/clash/component/nat"
"github.com/Dreamacro/clash/component/resolver"
Expand Down
1 change: 0 additions & 1 deletion tunnel/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ func safeAssertProxyType(adapter C.Proxy, metadata *C.Metadata, proxyType C.Adap
return false
}
}

0 comments on commit b2ee604

Please sign in to comment.