Style: use gofumpt for fmt

This commit is contained in:
Dreamacro
2021-10-10 23:44:09 +08:00
parent 4ce35870fe
commit f1cf7e9269
34 changed files with 78 additions and 84 deletions

View File

@ -27,12 +27,10 @@ var (
ErrSmallBuffer = errors.New("buffer too small")
)
var (
defaultHeader = http.Header{
"content-type": []string{"application/grpc"},
"user-agent": []string{"grpc-go/1.36.0"},
}
)
var defaultHeader = http.Header{
"content-type": []string{"application/grpc"},
"user-agent": []string{"grpc-go/1.36.0"},
}
type DialFn = func(network, addr string) (net.Conn, error)

View File

@ -78,6 +78,7 @@ func (to *TLSObfs) Read(b []byte) (int, error) {
// type + ver = 3
return to.read(b, 3)
}
func (to *TLSObfs) Write(b []byte) (int, error) {
length := len(b)
for i := 0; i < length; i += chunkSize {

View File

@ -20,6 +20,7 @@ func (sc *snellCipher) SaltSize() int { return 16 }
func (sc *snellCipher) Encrypter(salt []byte) (cipher.AEAD, error) {
return sc.makeAEAD(snellKDF(sc.psk, salt, sc.KeySize()))
}
func (sc *snellCipher) Decrypter(salt []byte) (cipher.AEAD, error) {
return sc.makeAEAD(snellKDF(sc.psk, salt, sc.KeySize()))
}

View File

@ -30,9 +30,7 @@ const (
Version byte = 1
)
var (
endSignal = []byte{}
)
var endSignal = []byte{}
type Snell struct {
net.Conn

View File

@ -184,7 +184,7 @@ func isReservedIP(ip net.IP) bool {
}
func readUntilNull(r io.Reader) ([]byte, error) {
var buf = &bytes.Buffer{}
buf := &bytes.Buffer{}
var data [1]byte
for {

View File

@ -14,8 +14,10 @@ import (
"github.com/Dreamacro/clash/transport/ssr/tools"
)
type hmacMethod func(key, data []byte) []byte
type hashDigestMethod func([]byte) []byte
type (
hmacMethod func(key, data []byte) []byte
hashDigestMethod func([]byte) []byte
)
func init() {
register("auth_aes128_sha1", newAuthAES128SHA1, 9)

View File

@ -92,7 +92,7 @@ func sealVMessAEADHeader(key [16]byte, data []byte, t time.Time) []byte {
payloadHeaderAEADEncrypted = payloadHeaderAEAD.Seal(nil, payloadHeaderAEADNonce, data, generatedAuthID[:])
}
var outputBuffer = &bytes.Buffer{}
outputBuffer := &bytes.Buffer{}
outputBuffer.Write(generatedAuthID[:])
outputBuffer.Write(payloadHeaderLengthAEADEncrypted)

View File

@ -28,6 +28,7 @@ type websocketConn struct {
rMux sync.Mutex
wMux sync.Mutex
}
type websocketWithEarlyDataConn struct {
net.Conn
underlay net.Conn