refactor grpc proxy backends to use machine management IP in metadata, including local responses

This commit is contained in:
Pavel Sviderski
2024-12-04 18:23:51 +10:00
parent 11612a802c
commit a4247b0097
3 changed files with 25 additions and 28 deletions
+5 -3
View File
@@ -20,11 +20,13 @@ type LocalBackend struct {
var _ proxy.Backend = (*LocalBackend)(nil)
// NewLocalBackend returns a new LocalBackend for the given Unix socket path.
func NewLocalBackend(sockPath string) *LocalBackend {
// NewLocalBackend returns a new LocalBackend for the given Unix socket path. The addr parameter is the local address
// of the current machine which could be empty if it's not known. The address is used to populate response metadata
// in one2many mode.
func NewLocalBackend(sockPath, addr string) *LocalBackend {
return &LocalBackend{
One2ManyResponder: One2ManyResponder{
machine: "local",
machine: addr,
},
sockPath: sockPath,
}