mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-16 06:54:14 +00:00
Add gRPC Transport support (#356)
Co-authored-by: JimhHan <50871214+JimhHan@users.noreply.github.com>
This commit is contained in:
parent
60b06877bf
commit
a0a32ee00d
23 changed files with 1564 additions and 4 deletions
|
@ -13,6 +13,8 @@ type TransportConfig struct {
|
|||
HTTPConfig *HTTPConfig `json:"httpSettings"`
|
||||
DSConfig *DomainSocketConfig `json:"dsSettings"`
|
||||
QUICConfig *QUICConfig `json:"quicSettings"`
|
||||
GRPCConfig *GRPCConfig `json:"grpcSettings"`
|
||||
GUNConfig *GRPCConfig `json:"gunSettings"`
|
||||
}
|
||||
|
||||
// Build implements Buildable.
|
||||
|
@ -85,5 +87,19 @@ func (c *TransportConfig) Build() (*global.Config, error) {
|
|||
})
|
||||
}
|
||||
|
||||
if c.GRPCConfig == nil {
|
||||
c.GRPCConfig = c.GUNConfig
|
||||
}
|
||||
if c.GRPCConfig != nil {
|
||||
gs, err := c.GRPCConfig.Build()
|
||||
if err != nil {
|
||||
return nil, newError("Failed to build gRPC config.").Base(err)
|
||||
}
|
||||
config.TransportSettings = append(config.TransportSettings, &internet.TransportConfig{
|
||||
ProtocolName: "grpc",
|
||||
Settings: serial.ToTypedMessage(gs),
|
||||
})
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue