1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-17 18:06:15 -05:00
v2fly/infra/conf/v4/browser_forwarder.go
2022-01-02 15:16:23 +00:00

26 lines
532 B
Go

package v4
import (
"strings"
"github.com/golang/protobuf/proto"
"github.com/v2fly/v2ray-core/v5/app/browserforwarder"
)
type BrowserForwarderConfig struct {
ListenAddr string `json:"listenAddr"`
ListenPort int32 `json:"listenPort"`
}
func (b *BrowserForwarderConfig) Build() (proto.Message, error) {
b.ListenAddr = strings.TrimSpace(b.ListenAddr)
if b.ListenAddr != "" && b.ListenPort == 0 {
b.ListenPort = 54321
}
return &browserforwarder.Config{
ListenAddr: b.ListenAddr,
ListenPort: b.ListenPort,
}, nil
}