Add per-route details to status, move socket to /srv/mc-proxy/
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>
This commit is contained in:
@@ -39,7 +39,7 @@ type Database struct {
|
||||
|
||||
// GRPC holds the gRPC admin API configuration.
|
||||
type GRPC struct {
|
||||
Addr string `toml:"addr"` // Unix socket path (e.g., "/var/run/mc-proxy.sock")
|
||||
Addr string `toml:"addr"` // Unix socket path (e.g., "/srv/mc-proxy/mc-proxy.sock")
|
||||
}
|
||||
|
||||
// Listener is a proxy listener with its routes.
|
||||
@@ -218,7 +218,7 @@ func (c *Config) validate() error {
|
||||
if c.GRPC.Addr != "" {
|
||||
socketPath := c.GRPC.SocketPath()
|
||||
if !strings.Contains(socketPath, "/") {
|
||||
return fmt.Errorf("grpc.addr must be a Unix socket path (e.g., /var/run/mc-proxy.sock)")
|
||||
return fmt.Errorf("grpc.addr must be a Unix socket path (e.g., /srv/mc-proxy/mc-proxy.sock)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ func TestGRPCSocketPath(t *testing.T) {
|
||||
addr string
|
||||
want string
|
||||
}{
|
||||
{"/var/run/mc-proxy.sock", "/var/run/mc-proxy.sock"},
|
||||
{"unix:/var/run/mc-proxy.sock", "/var/run/mc-proxy.sock"},
|
||||
{"/srv/mc-proxy/mc-proxy.sock", "/srv/mc-proxy/mc-proxy.sock"},
|
||||
{"unix:/srv/mc-proxy/mc-proxy.sock", "/srv/mc-proxy/mc-proxy.sock"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
g := GRPC{Addr: tt.addr}
|
||||
@@ -220,7 +220,7 @@ func TestValidateGRPCUnixSocket(t *testing.T) {
|
||||
path = "/tmp/test.db"
|
||||
|
||||
[grpc]
|
||||
addr = "/var/run/mc-proxy.sock"
|
||||
addr = "/srv/mc-proxy/mc-proxy.sock"
|
||||
`
|
||||
if err := os.WriteFile(path, []byte(data), 0600); err != nil {
|
||||
t.Fatalf("write config: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user