mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Chore: Run gofmt (#3990)
This commit is contained in:
parent
bc4bf3d38f
commit
83bab5dd90
50 changed files with 272 additions and 273 deletions
|
@ -56,7 +56,7 @@ func dialgRPC(ctx context.Context, dest net.Destination, streamSettings *interne
|
|||
}
|
||||
client := encoding.NewGRPCServiceClient(conn)
|
||||
if grpcSettings.MultiMode {
|
||||
errors.LogDebug(ctx, "using gRPC multi mode service name: `" + grpcSettings.getServiceName() + "` stream name: `" + grpcSettings.getTunMultiStreamName() + "`")
|
||||
errors.LogDebug(ctx, "using gRPC multi mode service name: `"+grpcSettings.getServiceName()+"` stream name: `"+grpcSettings.getTunMultiStreamName()+"`")
|
||||
grpcService, err := client.(encoding.GRPCServiceClientX).TunMultiCustomName(ctx, grpcSettings.getServiceName(), grpcSettings.getTunMultiStreamName())
|
||||
if err != nil {
|
||||
return nil, errors.New("Cannot dial gRPC").Base(err)
|
||||
|
@ -64,7 +64,7 @@ func dialgRPC(ctx context.Context, dest net.Destination, streamSettings *interne
|
|||
return encoding.NewMultiHunkConn(grpcService, nil), nil
|
||||
}
|
||||
|
||||
errors.LogDebug(ctx, "using gRPC tun mode service name: `" + grpcSettings.getServiceName() + "` stream name: `" + grpcSettings.getTunStreamName() + "`")
|
||||
errors.LogDebug(ctx, "using gRPC tun mode service name: `"+grpcSettings.getServiceName()+"` stream name: `"+grpcSettings.getTunStreamName()+"`")
|
||||
grpcService, err := client.(encoding.GRPCServiceClientX).TunCustomName(ctx, grpcSettings.getServiceName(), grpcSettings.getTunStreamName())
|
||||
if err != nil {
|
||||
return nil, errors.New("Cannot dial gRPC").Base(err)
|
||||
|
|
|
@ -120,7 +120,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, settings *i
|
|||
}
|
||||
}
|
||||
|
||||
errors.LogDebug(ctx, "gRPC listen for service name `" + grpcSettings.getServiceName() + "` tun `" + grpcSettings.getTunStreamName() + "` multi tun `" + grpcSettings.getTunMultiStreamName() + "`")
|
||||
errors.LogDebug(ctx, "gRPC listen for service name `"+grpcSettings.getServiceName()+"` tun `"+grpcSettings.getTunStreamName()+"` multi tun `"+grpcSettings.getTunMultiStreamName()+"`")
|
||||
encoding.RegisterGRPCServiceServerX(s, listener, grpcSettings.getServiceName(), grpcSettings.getTunStreamName(), grpcSettings.getTunMultiStreamName())
|
||||
|
||||
if config := reality.ConfigFromStreamSettings(settings); config != nil {
|
||||
|
|
|
@ -103,7 +103,7 @@ func TestH3Connection(t *testing.T) {
|
|||
SecurityType: "tls",
|
||||
SecuritySettings: &tls.Config{
|
||||
NextProtocol: []string{"h3"},
|
||||
Certificate: []*tls.Certificate{tls.ParseCertificate(cert.MustGenerate(nil, cert.CommonName("www.example.com")))},
|
||||
Certificate: []*tls.Certificate{tls.ParseCertificate(cert.MustGenerate(nil, cert.CommonName("www.example.com")))},
|
||||
},
|
||||
}, func(conn stat.Connection) {
|
||||
go func() {
|
||||
|
@ -133,7 +133,7 @@ func TestH3Connection(t *testing.T) {
|
|||
ProtocolSettings: &Config{},
|
||||
SecurityType: "tls",
|
||||
SecuritySettings: &tls.Config{
|
||||
NextProtocol: []string{"h3"},
|
||||
NextProtocol: []string{"h3"},
|
||||
ServerName: "www.example.com",
|
||||
AllowInsecure: true,
|
||||
},
|
||||
|
|
|
@ -141,8 +141,8 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
isH3 := len(tlsConfig.NextProtos) == 1 && tlsConfig.NextProtos[0] == "h3"
|
||||
listener := &Listener{
|
||||
handler: handler,
|
||||
config: httpSettings,
|
||||
isH3: isH3,
|
||||
config: httpSettings,
|
||||
isH3: isH3,
|
||||
}
|
||||
if port == net.Port(0) { // unix
|
||||
listener.local = &net.UnixAddr{
|
||||
|
@ -168,7 +168,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
if isH3 {
|
||||
Conn, err := internet.ListenSystemPacket(context.Background(), listener.local, streamSettings.SocketSettings)
|
||||
if err != nil {
|
||||
return nil, errors.New("failed to listen UDP(for SH3) on ", address, ":", port).Base(err)
|
||||
return nil, errors.New("failed to listen UDP(for SH3) on ", address, ":", port).Base(err)
|
||||
}
|
||||
h3listener, err := quic.ListenEarly(Conn, tlsConfig, nil)
|
||||
if err != nil {
|
||||
|
@ -188,7 +188,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
var server *http.Server
|
||||
if config == nil {
|
||||
h2s := &http2.Server{}
|
||||
|
||||
|
||||
server = &http.Server{
|
||||
Addr: serial.Concat(address, ":", port),
|
||||
Handler: h2c.NewHandler(listener, h2s),
|
||||
|
@ -202,7 +202,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
ReadHeaderTimeout: time.Second * 4,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
listener.server = server
|
||||
go func() {
|
||||
var streamListener net.Listener
|
||||
|
@ -226,7 +226,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if config == nil {
|
||||
if config := reality.ConfigFromStreamSettings(streamSettings); config != nil {
|
||||
streamListener = goreality.NewListener(streamListener, config.GetREALITYConfig())
|
||||
|
@ -241,7 +241,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
errors.LogInfoInner(ctx, err, "stopping serving TLS H2")
|
||||
}
|
||||
}
|
||||
}()
|
||||
}()
|
||||
}
|
||||
|
||||
return listener, nil
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package tls
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/hmac"
|
||||
"crypto/tls"
|
||||
|
@ -10,7 +11,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"bytes"
|
||||
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
|
@ -70,7 +70,7 @@ func (c *Config) BuildCertificates() []*tls.Certificate {
|
|||
continue
|
||||
}
|
||||
index := len(certs) - 1
|
||||
setupOcspTicker(entry, func(isReloaded, isOcspstapling bool){
|
||||
setupOcspTicker(entry, func(isReloaded, isOcspstapling bool) {
|
||||
cert := certs[index]
|
||||
if isReloaded {
|
||||
if newKeyPair := getX509KeyPair(); newKeyPair != nil {
|
||||
|
@ -162,7 +162,7 @@ func (c *Config) getCustomCA() []*Certificate {
|
|||
for _, certificate := range c.Certificate {
|
||||
if certificate.Usage == Certificate_AUTHORITY_ISSUE {
|
||||
certs = append(certs, certificate)
|
||||
setupOcspTicker(certificate, func(isReloaded, isOcspstapling bool){ })
|
||||
setupOcspTicker(certificate, func(isReloaded, isOcspstapling bool) {})
|
||||
}
|
||||
}
|
||||
return certs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue