proxy.go 556 B

123456789101112131415161718192021
  1. package proxycfg
  2. import "github.com/v2fly/v2ray-core/v4/transport/internet"
  3. type ProxyConfig struct {
  4. Tag string `json:"tag"`
  5. TransportLayerProxy bool `json:"transportLayer"`
  6. }
  7. //go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen
  8. // Build implements Buildable.
  9. func (v *ProxyConfig) Build() (*internet.ProxyConfig, error) {
  10. if v.Tag == "" {
  11. return nil, newError("Proxy tag is not set.")
  12. }
  13. return &internet.ProxyConfig{
  14. Tag: v.Tag,
  15. TransportLayerProxy: v.TransportLayerProxy,
  16. }, nil
  17. }