File tree 2 files changed +7
-13
lines changed
2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -28,25 +28,18 @@ func init() {
28
28
// The format is "VMID:Service", "VMID", or ":Service" as well as an
29
29
// empty string. For VMID we also support "parent" and assume
30
30
// "loopback" if the string can't be parsed.
31
- func hvsockParseSockStr (sockStr string ) hvsockAddr {
31
+ func hvsockParseSockStr (vmStr , svcStr string ) hvsockAddr {
32
32
hvAddr := hvsock.Addr {hvsock .GUIDZero , svcid }
33
33
port , _ := svcid .Port ()
34
34
vAddr := vsock.Addr {vsock .CIDAny , port }
35
- if sockStr == "" {
35
+ if svcStr != "" && svcStr [0 ] == '/' {
36
+ svcStr = svcStr [1 :]
37
+ }
38
+ if vmStr == "" && svcStr == "" {
36
39
return hvsockAddr {hvAddr : hvAddr , vAddr : vAddr }
37
40
}
38
41
39
42
var err error
40
- vmStr := ""
41
- svcStr := ""
42
- if strings .Contains (sockStr , ":" ) {
43
- vmStr , svcStr , err = net .SplitHostPort (sockStr )
44
- if err != nil {
45
- log .Fatalf ("Error parsing socket string '%s': %v" , sockStr , err )
46
- }
47
- } else {
48
- vmStr = sockStr
49
- }
50
43
51
44
if vmStr != "" {
52
45
if strings .Contains (vmStr , "-" ) {
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ func init() {
99
99
fmt .Printf (" %s -s vsock Start server in vsock mode on standard port\n " , prog )
100
100
fmt .Printf (" %s -s vsock://:1235 Start server in vsock mode on a non-standard port\n " , prog )
101
101
fmt .Printf (" %s -c hvsock://<vmid> Start client in hvsock mode connecting to VM with <vmid>\n " , prog )
102
+ fmt .Printf (" %s -c hvsock://<vmid>/<svcid> Start client in hvsock mode connecting to VM with <vmid> on a non-standard <svcid>\n " , prog )
102
103
}
103
104
rand .Seed (time .Now ().UnixNano ())
104
105
}
@@ -172,7 +173,7 @@ func parseSockStr(inStr string) (string, Sock) {
172
173
case "vsock" :
173
174
return u .Scheme , vsockParseSockStr (u .Host )
174
175
case "hvsock" :
175
- return u .Scheme , hvsockParseSockStr (u .Host )
176
+ return u .Scheme , hvsockParseSockStr (u .Host , u . Path )
176
177
case "tcp" , "tcp4" , "tcp6" :
177
178
return u .Scheme , tcpParseSockStr (u .Scheme , u .Host )
178
179
case "udp" , "udp4" , "udp6" :
You can’t perform that action at this time.
0 commit comments