theckman/httpforwarded

GitHub: theckman/httpforwarded

一个用于解析 RFC-7239 Forwarded HTTP 标头的 Go 语言工具库,帮助开发者在反向代理场景下获取真实客户端信息。

Stars: 5 | Forks: 4

# httpforwarded [![TravisCI 构建状态](https://img.shields.io/travis/theckman/httpforwarded/master.svg)](https://travis-ci.org/theckman/httpforwarded) [![许可证](https://img.shields.io/badge/license-BSD--style_3--clause-brightgreen.svg?style=flat)](https://github.com/theckman/httpforwarded/blob/master/LICENSE) [![GoDoc](https://img.shields.io/badge/GoDoc-httpforwarded-blue.svg)](https://godoc.org/github.com/theckman/httpforwarded) `httpforwarded` Go 包提供了用于处理 [RFC-7239](https://tools.ietf.org/html/rfc7239) 中定义的 `Forwarded` HTTP 标头的实用函数。 该标头旨在替换 `X-Forwarded-For` 和 `X-Forwarded-Proto` 等标头。 这个包深受标准库中 `mime` 包的启发, 更具体地说是 [ParseMediaType()](https://golang.org/pkg/mime/#ParseMediaType) 函数。 ## 许可证 该包直接从 Go 标准库中复制了一些函数,未作任何修改。因此,整个包均采用 与 Go 语言本身相同的宽松 BSD 风格许可证发布。请参阅 [LICENSE](https://github.com/theckman/httpforwarded/blob/master/LICENSE) 文件的内容以获取完整的许可证详情。 ## 安装 要安装此包以供使用,您可以运行以下命令: ``` go get -u github.com/theckman/httpforwarded ``` 如果您还希望参与 `httpforwarded` 的开发,还可以 安装测试依赖项: ``` go get -t -u github.com/theckman/httpforwarded ``` ## 用法 ``` // var req *http.Request headerValues := req.Header[http.CanonicalHeaderKey("forwarded")] params, _ := httpforwarded.Parse(headerValues) // you can then do something like this to get the first "for" param: fmt.Printf("origin %s", params["for"][0]) ``` 有关使用该包的更多信息,请参阅 [GoDoc](https://godoc.org/github.com/theckman/httpforwarded) 页面。
标签:EVTX分析, Go, Ruby工具, SOC Prime, Syscall, Web开发, 内核驱动, 开发工具, 日志审计, 网络协议, 解析库