mitm

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	HostsHeader = "# GoRoute AgentBridge DNS Interception Begin"
	HostsFooter = "# GoRoute AgentBridge DNS Interception End"
)

Variables

View Source
var AgentBridgeTargets = map[string][]string{
	"antigravity": {
		"daily-cloudcode-pa.googleapis.com",
		"cloudcode-pa.googleapis.com",
		"daily-cloudcode-pa.sandbox.googleapis.com",
		"autopush-cloudcode-pa.sandbox.googleapis.com",
	},
	"copilot": {
		"api.githubcopilot.com",
		"copilot-proxy.githubusercontent.com",
	},
	"claude-code": {
		"api.anthropic.com",
	},
	"cursor": {
		"api2.cursor.sh",
	},
	"codex": {
		"api.openai.com",
	},
}

AgentBridgeTargets maps tools to their default API endpoints that can be intercepted via /etc/hosts or DNS.

View Source
var InterceptedHosts = map[string]string{
	"api.anthropic.com":                   "anthropic",
	"api.openai.com":                      "openai",
	"api.githubcopilot.com":               "copilot",
	"copilot-proxy.githubusercontent.com": "copilot",
	"cloudcode-pa.googleapis.com":         "antigravity",
}

Functions

func GenerateHostsEntries

func GenerateHostsEntries(targets []string) string

GenerateHostsEntries generates hosts file content mapping targets to 127.0.0.1.

func ParseManagedHosts

func ParseManagedHosts(content string) []string

ParseHostsLines returns all hosts currently managed by GoRoute in the given hosts file.

func ReadHosts

func ReadHosts(path string) (string, error)

ReadHosts reads the system hosts file.

func UpdateHostsContent

func UpdateHostsContent(existingContent string, targets []string) string

UpdateHostsContent adds or updates GoRoute entries in a raw hosts file content.

Types

type TargetHost

type TargetHost struct {
	Host     string
	Provider string
}

type TunnelServer

type TunnelServer struct {
	// contains filtered or unexported fields
}

func NewTunnelServer

func NewTunnelServer(routerAddr string) (*TunnelServer, error)

func (*TunnelServer) HandleConnect

func (ts *TunnelServer) HandleConnect(w http.ResponseWriter, r *http.Request)

HandleConnect implements RFC 2817 HTTP CONNECT tunneling and transparent forwarding

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL