@@ -57,16 +57,17 @@ type OverrideSchema struct {
57
57
}
58
58
59
59
type proxyProviderSchema struct {
60
- Type string `provider:"type"`
61
- Path string `provider:"path,omitempty"`
62
- URL string `provider:"url,omitempty"`
63
- Proxy string `provider:"proxy,omitempty"`
64
- Interval int `provider:"interval,omitempty"`
65
- Filter string `provider:"filter,omitempty"`
66
- ExcludeFilter string `provider:"exclude-filter,omitempty"`
67
- ExcludeType string `provider:"exclude-type,omitempty"`
68
- DialerProxy string `provider:"dialer-proxy,omitempty"`
69
- SizeLimit int64 `provider:"size-limit,omitempty"`
60
+ Type string `provider:"type"`
61
+ Path string `provider:"path,omitempty"`
62
+ URL string `provider:"url,omitempty"`
63
+ Proxy string `provider:"proxy,omitempty"`
64
+ Interval int `provider:"interval,omitempty"`
65
+ Filter string `provider:"filter,omitempty"`
66
+ ExcludeFilter string `provider:"exclude-filter,omitempty"`
67
+ ExcludeType string `provider:"exclude-type,omitempty"`
68
+ DialerProxy string `provider:"dialer-proxy,omitempty"`
69
+ SizeLimit int64 `provider:"size-limit,omitempty"`
70
+ Payload []map [string ]any `provider:"payload,omitempty"`
70
71
71
72
HealthCheck healthCheckSchema `provider:"health-check,omitempty"`
72
73
Override OverrideSchema `provider:"override,omitempty"`
@@ -99,6 +100,11 @@ func ParseProxyProvider(name string, mapping map[string]any) (types.ProxyProvide
99
100
}
100
101
hc := NewHealthCheck ([]C.Proxy {}, schema .HealthCheck .URL , uint (schema .HealthCheck .TestTimeout ), hcInterval , schema .HealthCheck .Lazy , expectedStatus )
101
102
103
+ parser , err := NewProxiesParser (schema .Filter , schema .ExcludeFilter , schema .ExcludeType , schema .DialerProxy , schema .Override )
104
+ if err != nil {
105
+ return nil , err
106
+ }
107
+
102
108
var vehicle types.Vehicle
103
109
switch schema .Type {
104
110
case "file" :
@@ -113,16 +119,13 @@ func ParseProxyProvider(name string, mapping map[string]any) (types.ProxyProvide
113
119
}
114
120
}
115
121
vehicle = resource .NewHTTPVehicle (schema .URL , path , schema .Proxy , schema .Header , resource .DefaultHttpTimeout , schema .SizeLimit )
122
+ case "inline" :
123
+ return NewInlineProvider (name , schema .Payload , parser , hc )
116
124
default :
117
125
return nil , fmt .Errorf ("%w: %s" , errVehicleType , schema .Type )
118
126
}
119
127
120
128
interval := time .Duration (uint (schema .Interval )) * time .Second
121
- filter := schema .Filter
122
- excludeFilter := schema .ExcludeFilter
123
- excludeType := schema .ExcludeType
124
- dialerProxy := schema .DialerProxy
125
- override := schema .Override
126
129
127
- return NewProxySetProvider (name , interval , filter , excludeFilter , excludeType , dialerProxy , override , vehicle , hc )
130
+ return NewProxySetProvider (name , interval , parser , vehicle , hc )
128
131
}
0 commit comments