feat: add CLI connector for unix domain socket (#186)

* feat: Add cli connector for unix domain socket

* Update cmd/uncloud/main.go

---------

Co-authored-by: Pasha Sviderski <me@psviderski.name>
This commit is contained in:
Justin Bradford
2025-11-25 21:45:07 +10:00
committed by GitHub
co-authored by Pasha Sviderski
parent e87207eae3
commit 91a09d5d37
5 changed files with 85 additions and 11 deletions
+23
View File
@@ -53,6 +53,13 @@ func TestMachineConnection_String(t *testing.T) {
},
want: "tcp://10.0.0.1:8080",
},
{
name: "unix connection",
conn: MachineConnection{
Unix: "/run/uncloud/uncloud.sock",
},
want: "unix:///run/uncloud/uncloud.sock",
},
{
name: "no connection",
conn: MachineConnection{},
@@ -112,6 +119,13 @@ func TestMachineConnection_Validate(t *testing.T) {
},
wantErr: false,
},
{
name: "unix only - valid",
conn: MachineConnection{
Unix: "/path/to/socket",
},
wantErr: false,
},
{
name: "no connection method - error",
conn: MachineConnection{},
@@ -127,6 +141,15 @@ func TestMachineConnection_Validate(t *testing.T) {
wantErr: true,
errMsg: "only one connection method allowed",
},
{
name: "ssh and unix - error",
conn: MachineConnection{
SSH: "user@host",
Unix: "/path/to/socket",
},
wantErr: true,
errMsg: "only one connection method allowed",
},
{
name: "ssh and tcp - error",
conn: MachineConnection{