Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rhaidiz/yves
An HTTP(s) and WebSocket Man-in-The-Middle proxy library written in Go.
https://github.com/rhaidiz/yves
http mitm proxy websocket
Last synced: 2 months ago
JSON representation
An HTTP(s) and WebSocket Man-in-The-Middle proxy library written in Go.
- Host: GitHub
- URL: https://github.com/rhaidiz/yves
- Owner: rhaidiz
- Created: 2021-06-01T20:20:19.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-28T08:50:00.000Z (about 1 year ago)
- Last Synced: 2024-06-20T07:55:08.535Z (7 months ago)
- Topics: http, mitm, proxy, websocket
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 19
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Yves
Yves is a simple HTTP(s) and WebSocket Man-in-The-Middle proxy.# Main Features
* HTTP(s) and WebSocket Man-in-The-Middle proxy;
* Custom HTTP request\response handlers;
* Custom WebSocket request\response handlers;
* Custom CA for TLS connections;
* Support for upstream proxy.# Usage
## Start a server
The following snippets of code shows how to start a simple mitm proxy.
More usage examples can be found in the examples folder.```go
package mainimport (
"log"
"net/http""github.com/rhaidiz/yves"
)func main() {
// create a new mitm proxy
proxy := yves.NewProxy()// Listen on local port 8080
log.Fatal(http.ListenAndServe(":8080", proxy))
}
```## Request handler
The following example shows how to use request handler to add a custom header to every request:
```go
proxy.HandleRequest = func(id int64, req *http.Request) *http.Response {
req.Header.Add("custom", "myval")
log.Printf("session: %v\n", id)
return nil
}
```## Response handler
The following example shows how to prevent access to a requests performed toward a specific host.```go
proxy.HandleRequest = func(id int64, req *http.Request) *http.Response {
if req.Host == "example.com" {
return &http.Response{StatusCode: 500}
}
return nil
```## Examples
More usage can be found in the [examples](examples/) folder.