chore(engine): remove unused lookupHost

This commit is contained in:
Javier Provecho Fernandez 2021-02-08 00:06:59 +00:00 committed by GitHub
parent c9ea8ece4a
commit 39b372f163
2 changed files with 0 additions and 16 deletions

View File

@ -1392,19 +1392,6 @@ func TestContextClientIP(t *testing.T) {
c, _ := CreateTestContext(httptest.NewRecorder())
c.Request, _ = http.NewRequest("POST", "/", nil)
c.engine.lookupHost = func(host string) ([]string, error) {
if host == "foo" {
return []string{"40.40.40.40", "30.30.30.30"}, nil
}
if host == "bar" {
return nil, errors.New("hostname lookup failed")
}
if host == "baz" {
return []string{"thisshouldneverhappen"}, nil
}
return []string{}, nil
}
resetContextForClientIPTests(c)
// Legacy tests (validating that the defaults don't break the

3
gin.go
View File

@ -106,8 +106,6 @@ type Engine struct {
// See the PR #1817 and issue #1644
RemoveExtraSlash bool
lookupHost func(string) ([]string, error)
delims render.Delims
secureJSONPrefix string
HTMLRender render.HTMLRender
@ -152,7 +150,6 @@ func New() *Engine {
RemoveExtraSlash: false,
UnescapePathValues: true,
MaxMultipartMemory: defaultMultipartMemory,
lookupHost: net.LookupHost,
trees: make(methodTrees, 0, 9),
delims: render.Delims{Left: "{{", Right: "}}"},
secureJSONPrefix: "while(1);",