mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-07 04:38:40 +00:00
Chore: Run gofmt (#3990)
This commit is contained in:
parent
bc4bf3d38f
commit
83bab5dd90
50 changed files with 272 additions and 273 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue