mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
fix some lint warnings.
This commit is contained in:
parent
e744537b80
commit
1955d72e3e
@ -108,12 +108,12 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
||||
config := tls.ConfigFromStreamSettings(streamSettings)
|
||||
if config == nil {
|
||||
// return nil, newError("TLS must be enabled for http transport.").AtWarning()
|
||||
h2s:=&http2.Server{}
|
||||
h2s := &http2.Server{}
|
||||
|
||||
server := &http.Server{
|
||||
Addr: serial.Concat(address, ":", port),
|
||||
Addr: serial.Concat(address, ":", port),
|
||||
// TLSConfig: config.GetTLSConfig(tls.WithNextProto("h2")),
|
||||
Handler: h2c.NewHandler(listener,h2s),
|
||||
Handler: h2c.NewHandler(listener, h2s),
|
||||
ReadHeaderTimeout: time.Second * 4,
|
||||
}
|
||||
|
||||
@ -135,33 +135,31 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
||||
}()
|
||||
|
||||
return listener, nil
|
||||
} else {
|
||||
server := &http.Server{
|
||||
Addr: serial.Concat(address, ":", port),
|
||||
TLSConfig: config.GetTLSConfig(tls.WithNextProto("h2")),
|
||||
Handler: listener,
|
||||
ReadHeaderTimeout: time.Second * 4,
|
||||
}
|
||||
server := &http.Server{
|
||||
Addr: serial.Concat(address, ":", port),
|
||||
TLSConfig: config.GetTLSConfig(tls.WithNextProto("h2")),
|
||||
Handler: listener,
|
||||
ReadHeaderTimeout: time.Second * 4,
|
||||
}
|
||||
|
||||
listener.server = server
|
||||
go func() {
|
||||
tcpListener, err := internet.ListenSystem(ctx, &net.TCPAddr{
|
||||
IP: address.IP(),
|
||||
Port: int(port),
|
||||
}, streamSettings.SocketSettings)
|
||||
if err != nil {
|
||||
newError("failed to listen on", address, ":", port).Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
return
|
||||
}
|
||||
|
||||
listener.server = server
|
||||
go func() {
|
||||
tcpListener, err := internet.ListenSystem(ctx, &net.TCPAddr{
|
||||
IP: address.IP(),
|
||||
Port: int(port),
|
||||
}, streamSettings.SocketSettings)
|
||||
if err != nil {
|
||||
newError("failed to listen on", address, ":", port).Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
return
|
||||
}
|
||||
|
||||
err = server.ServeTLS(tcpListener, "", "")
|
||||
if err != nil {
|
||||
newError("stoping serving TLS").Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
}
|
||||
}()
|
||||
|
||||
return listener, nil
|
||||
}
|
||||
err = server.ServeTLS(tcpListener, "", "")
|
||||
if err != nil {
|
||||
newError("stoping serving TLS").Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
}
|
||||
}()
|
||||
return listener, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
Loading…
Reference in New Issue
Block a user