mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Add custom header support for HTTP proxy
This commit is contained in:
parent
d7ac6946d2
commit
c9b6fc0104
4 changed files with 172 additions and 28 deletions
|
@ -53,6 +53,7 @@ type HTTPRemoteConfig struct {
|
|||
|
||||
type HTTPClientConfig struct {
|
||||
Servers []*HTTPRemoteConfig `json:"servers"`
|
||||
Headers map[string]string `json:"headers"`
|
||||
}
|
||||
|
||||
func (v *HTTPClientConfig) Build() (proto.Message, error) {
|
||||
|
@ -77,5 +78,12 @@ func (v *HTTPClientConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
config.Server[idx] = server
|
||||
}
|
||||
config.Header = make([]*http.Header, 0, 32)
|
||||
for key, value := range v.Headers {
|
||||
config.Header = append(config.Header, &http.Header{
|
||||
Key: key,
|
||||
Value: value,
|
||||
})
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue