mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-30 13:17:11 -05:00
added parsing of browser forwarder config
This commit is contained in:
parent
af641f3219
commit
e161d6cc1f
18
infra/conf/browser_forwarder.go
Normal file
18
infra/conf/browser_forwarder.go
Normal file
@ -0,0 +1,18 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/v2fly/v2ray-core/v4/app/browserforwarder"
|
||||
)
|
||||
|
||||
type BrowserForwarderConfig struct {
|
||||
ListenAddr string `json:"listenAddr"`
|
||||
ListenPort int32 `json:"listenPort"`
|
||||
}
|
||||
|
||||
func (b BrowserForwarderConfig) Build() (proto.Message, error) {
|
||||
return &browserforwarder.Config{
|
||||
ListenAddr: b.ListenAddr,
|
||||
ListenPort: b.ListenPort,
|
||||
}, nil
|
||||
}
|
@ -341,17 +341,18 @@ type Config struct {
|
||||
// and should not be used.
|
||||
OutboundDetours []OutboundDetourConfig `json:"outboundDetour"`
|
||||
|
||||
LogConfig *LogConfig `json:"log"`
|
||||
RouterConfig *RouterConfig `json:"routing"`
|
||||
DNSConfig *DNSConfig `json:"dns"`
|
||||
InboundConfigs []InboundDetourConfig `json:"inbounds"`
|
||||
OutboundConfigs []OutboundDetourConfig `json:"outbounds"`
|
||||
Transport *TransportConfig `json:"transport"`
|
||||
Policy *PolicyConfig `json:"policy"`
|
||||
API *APIConfig `json:"api"`
|
||||
Stats *StatsConfig `json:"stats"`
|
||||
Reverse *ReverseConfig `json:"reverse"`
|
||||
FakeDNS *FakeDNSConfig `json:"fakeDns"`
|
||||
LogConfig *LogConfig `json:"log"`
|
||||
RouterConfig *RouterConfig `json:"routing"`
|
||||
DNSConfig *DNSConfig `json:"dns"`
|
||||
InboundConfigs []InboundDetourConfig `json:"inbounds"`
|
||||
OutboundConfigs []OutboundDetourConfig `json:"outbounds"`
|
||||
Transport *TransportConfig `json:"transport"`
|
||||
Policy *PolicyConfig `json:"policy"`
|
||||
API *APIConfig `json:"api"`
|
||||
Stats *StatsConfig `json:"stats"`
|
||||
Reverse *ReverseConfig `json:"reverse"`
|
||||
FakeDNS *FakeDNSConfig `json:"fakeDns"`
|
||||
BrowserForwarder *BrowserForwarderConfig `json:"browserForwarder"`
|
||||
}
|
||||
|
||||
func (c *Config) findInboundTag(tag string) int {
|
||||
@ -558,6 +559,14 @@ func (c *Config) Build() (*core.Config, error) {
|
||||
config.App = append(config.App, serial.ToTypedMessage(r))
|
||||
}
|
||||
|
||||
if c.BrowserForwarder != nil {
|
||||
r, err := c.BrowserForwarder.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
config.App = append(config.App, serial.ToTypedMessage(r))
|
||||
}
|
||||
|
||||
var inbounds []InboundDetourConfig
|
||||
|
||||
if c.InboundConfig != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user