mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Add REALITY support to H2 server
Now you are able to configure REALITY H2 server directly Before: REALITY VLESS fallbacks -> H2C inbound
This commit is contained in:
parent
c38179a67f
commit
9401d65ef1
3 changed files with 10 additions and 5 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
goreality "github.com/xtls/reality"
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/net/cnc"
|
||||
|
@ -15,6 +16,7 @@ import (
|
|||
"github.com/xtls/xray-core/common/session"
|
||||
"github.com/xtls/xray-core/common/signal/done"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
"github.com/xtls/xray-core/transport/internet/reality"
|
||||
"github.com/xtls/xray-core/transport/internet/tls"
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/h2c"
|
||||
|
@ -187,14 +189,17 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
}
|
||||
|
||||
if config == nil {
|
||||
if config := reality.ConfigFromStreamSettings(streamSettings); config != nil {
|
||||
streamListener = goreality.NewListener(streamListener, config.GetREALITYConfig())
|
||||
}
|
||||
err = server.Serve(streamListener)
|
||||
if err != nil {
|
||||
newError("stopping serving H2C").Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
newError("stopping serving H2C or REALITY H2").Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
}
|
||||
} else {
|
||||
err = server.ServeTLS(streamListener, "", "")
|
||||
if err != nil {
|
||||
newError("stopping serving TLS").Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
newError("stopping serving TLS H2").Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue