mcproxyctl status now shows individual routes per listener with hostname, backend, mode, and re-encrypt indicator. Proto, gRPC server, client library, and CLI all updated. Default gRPC socket path moved from /var/run/mc-proxy.sock to /srv/mc-proxy/mc-proxy.sock to match the service data directory convention. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
// Package mcproxy provides a Go client for the mc-proxy gRPC admin API.
|
|
//
|
|
// The client connects to mc-proxy via Unix socket and provides methods
|
|
// for managing routes, firewall rules, and querying server status.
|
|
//
|
|
// # Basic Usage
|
|
//
|
|
// client, err := mcproxy.Dial("/srv/mc-proxy/mc-proxy.sock")
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
// defer client.Close()
|
|
//
|
|
// // Get server status
|
|
// status, err := client.GetStatus(ctx)
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
// fmt.Printf("mc-proxy %s, %d connections\n", status.Version, status.TotalConnections)
|
|
//
|
|
// // List routes for a listener
|
|
// routes, err := client.ListRoutes(ctx, ":443")
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
// for _, r := range routes {
|
|
// fmt.Printf(" %s -> %s\n", r.Hostname, r.Backend)
|
|
// }
|
|
//
|
|
// // Add a route
|
|
// err = client.AddRoute(ctx, ":443", "example.com", "127.0.0.1:8443")
|
|
//
|
|
// // Add a firewall rule
|
|
// err = client.AddFirewallRule(ctx, mcproxy.FirewallRuleCIDR, "10.0.0.0/8")
|
|
//
|
|
// // Check health
|
|
// health, err := client.CheckHealth(ctx)
|
|
// if health == mcproxy.HealthServing {
|
|
// fmt.Println("Server is healthy")
|
|
// }
|
|
package mcproxy
|