{"id":13764100,"url":"https://github.com/sebest/xff","last_synced_at":"2026-01-10T15:47:20.780Z","repository":{"id":24917472,"uuid":"28334401","full_name":"sebest/xff","owner":"sebest","description":"A Golang Middleware to handle X-Forwarded-For Header","archived":false,"fork":false,"pushed_at":"2022-01-18T20:54:49.000Z","size":14,"stargazers_count":98,"open_issues_count":8,"forks_count":26,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-16T23:32:36.548Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sebest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-22T10:29:05.000Z","updated_at":"2023-11-16T19:18:37.000Z","dependencies_parsed_at":"2022-07-16T15:00:39.888Z","dependency_job_id":null,"html_url":"https://github.com/sebest/xff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebest%2Fxff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebest%2Fxff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebest%2Fxff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebest%2Fxff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sebest","download_url":"https://codeload.github.com/sebest/xff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253453325,"owners_count":21911078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T15:01:13.801Z","updated_at":"2026-01-10T15:47:20.705Z","avatar_url":"https://github.com/sebest.png","language":"Go","readme":"# X-Forwarded-For middleware fo Go [![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/sebest/xff) [![Build Status](https://travis-ci.org/sebest/xff.svg?branch=master)](https://travis-ci.org/sebest/xff)\n\nPackage `xff` is a `net/http` middleware/handler to parse [Forwarded HTTP Extension](http://tools.ietf.org/html/rfc7239) in Golang.\n\n## Example usage\n\nInstall `xff`:\n\n    go get github.com/sebest/xff\n\nEdit `server.go`:\n\n```go\npackage main\n\nimport (\n  \"net/http\"\n\n  \"github.com/sebest/xff\"\n)\n\nfunc main() {\n  handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n    w.Write([]byte(\"hello from \" + r.RemoteAddr + \"\\n\"))\n  })\n\n  xffmw, _ := xff.Default()\n  http.ListenAndServe(\":8080\", xffmw.Handler(handler))\n}\n```\n\nThen run your server:\n\n    go run server.go\n\nThe server now runs on `localhost:8080`:\n\n    $ curl -D - -H 'X-Forwarded-For: 42.42.42.42' http://localhost:8080/\n    HTTP/1.1 200 OK\n    Date: Fri, 20 Feb 2015 20:03:02 GMT\n    Content-Length: 29\n    Content-Type: text/plain; charset=utf-8\n\n    hello from 42.42.42.42:52661\n","funding_links":[],"categories":["Web Frameworks","Web框架","XML","中间件### 中间件","Actual middlewares","中间件"],"sub_categories":["Middlewares","中间件","中間件","Fail injection","版本控制`版本控制相关库`"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebest%2Fxff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebest%2Fxff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebest%2Fxff/lists"}