You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/common/protocol/http/headers_test.go

21 lines
448 B

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")
}