Style: format code by gofumpt (#761)

This commit is contained in:
yuhan6665 2021-10-19 12:57:14 -04:00 committed by GitHub
parent d77be80b40
commit e286cdcaa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
111 changed files with 293 additions and 291 deletions

View file

@ -133,13 +133,11 @@ func Inverse(b []byte) []byte {
return b2
}
var (
authPool = sync.Pool{
New: func() interface{} {
return new(Authentication)
},
}
)
var authPool = sync.Pool{
New: func() interface{} {
return new(Authentication)
},
}
func getAuthenticationObject() *Authentication {
return authPool.Get().(*Authentication)

View file

@ -13,8 +13,7 @@ import (
"github.com/xtls/xray-core/transport/internet"
)
type Client struct {
}
type Client struct{}
func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {
return &Client{}, nil
@ -62,7 +61,7 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
return buf.Copy(connReader, link.Writer)
}
var responseDoneAndCloseWriter = task.OnSuccess(response, task.Close(link.Writer))
responseDoneAndCloseWriter := task.OnSuccess(response, task.Close(link.Writer))
if err := task.Run(ctx, request, responseDoneAndCloseWriter); err != nil {
return newError("connection ends").Base(err)
}

View file

@ -20,15 +20,13 @@ import (
"github.com/xtls/xray-core/features/routing"
)
var (
dcList = []net.Address{
net.ParseAddress("149.154.175.50"),
net.ParseAddress("149.154.167.51"),
net.ParseAddress("149.154.175.100"),
net.ParseAddress("149.154.167.91"),
net.ParseAddress("149.154.171.5"),
}
)
var dcList = []net.Address{
net.ParseAddress("149.154.175.50"),
net.ParseAddress("149.154.167.51"),
net.ParseAddress("149.154.175.100"),
net.ParseAddress("149.154.167.91"),
net.ParseAddress("149.154.171.5"),
}
type Server struct {
user *protocol.User
@ -64,8 +62,10 @@ func (s *Server) Network() []net.Network {
return []net.Network{net.Network_TCP}
}
var ctype1 = []byte{0xef, 0xef, 0xef, 0xef}
var ctype2 = []byte{0xee, 0xee, 0xee, 0xee}
var (
ctype1 = []byte{0xef, 0xef, 0xef, 0xef}
ctype2 = []byte{0xee, 0xee, 0xee, 0xee}
)
func isValidConnectionType(c [4]byte) bool {
if bytes.Equal(c[:], ctype1) {
@ -144,7 +144,7 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Con
return buf.Copy(link.Reader, writer, buf.UpdateActivity(timer))
}
var responseDoneAndCloseWriter = task.OnSuccess(response, task.Close(link.Writer))
responseDoneAndCloseWriter := task.OnSuccess(response, task.Close(link.Writer))
if err := task.Run(ctx, request, responseDoneAndCloseWriter); err != nil {
common.Interrupt(link.Reader)
common.Interrupt(link.Writer)