mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-07-04 15:40:54 +00:00
21 lines
448 B
Go
21 lines
448 B
Go
![]() |
package http_test
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
"testing"
|
||
|
|
||
|
. "v2ray.com/core/common/protocol/http"
|
||
|
. "v2ray.com/ext/assert"
|
||
|
)
|
||
|
|
||
|
func TestParseXForwardedFor(t *testing.T) {
|
||
|
assert := With(t)
|
||
|
|
||
|
header := http.Header{}
|
||
|
header.Add("X-Forwarded-For", "129.78.138.66, 129.78.64.103")
|
||
|
addrs := ParseXForwardedFor(header)
|
||
|
assert(len(addrs), Equals, 2)
|
||
|
assert(addrs[0].String(), Equals, "129.78.138.66")
|
||
|
assert(addrs[1].String(), Equals, "129.78.64.103")
|
||
|
}
|