* Deprecate host and port fields in Upstream message; introduce uri field for connection details * Update libplugin/plugin.proto Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor(grpc): streamline upstream connection handling and add GetOrGenerateUri method * refactor(libplugin): update GetOrGenerateUri to return error and add IPv6 test * refactor(libplugin): simplify GetOrGenerateUri to remove error return and update tests * Update cmd/sshpiperd/internal/plugin/grpc.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
15 lines
284 B
Go
15 lines
284 B
Go
package libplugin
|
|
|
|
import "testing"
|
|
|
|
func TestGetOrGenerateUri_GeneratesUriWithIPv6(t *testing.T) {
|
|
up := &Upstream{
|
|
Host: "2001:db8::1",
|
|
Port: 2222,
|
|
}
|
|
|
|
got := up.GetOrGenerateUri()
|
|
if got != "tcp://[2001:db8::1]:2222" {
|
|
t.Errorf("expected generated uri, got %q", got)
|
|
}
|
|
}
|