You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the only way to specify an address to connect to is to use the -addr flag. This is not a problem, per se, but I think it might be useful to also be able to imply the address in the argument itself when only dealing with a single argument if the -addr flag isn't specified. For example, running p9 ls -l ./example.sock/path/to/a/file would dial example.sock and then request path/to/a/file. I think that a simple heuristic for determining what to do should work for most cases:
If the path starts with ./, assume that it is a Unix socket relative to the current directory. Traverse the path one element at a time until that socket is found, then dial it and use the remainder of the path for the request.
If the path starts with /, assume that it is an absolute path to a Unix socket. Find it in the same was as for ./.
If the path does not start with a slash but contains a colon before the first slash, assume everything before the first slash is a TCP address.
If the path does not start with a slash but contains a !, assume that separates a network type from an address. If it is a Unix network, find it in the same way as above. If it contains two !, assume that the second separates a port number and replace it with a :.
If it does not start with a slash and does not contain a : or a !and doesn't seem to point to an existing Unix socket, assume that the first element is a Plan 9 namespace and look it up as appropriate.
The existing parseAddr() function can be reworked to have this functionality. That should simplify implementation and ensure consistency in how the dialing works.
The text was updated successfully, but these errors were encountered:
Currently, the only way to specify an address to connect to is to use the
-addr
flag. This is not a problem, per se, but I think it might be useful to also be able to imply the address in the argument itself when only dealing with a single argument if the-addr
flag isn't specified. For example, runningp9 ls -l ./example.sock/path/to/a/file
would dialexample.sock
and then requestpath/to/a/file
. I think that a simple heuristic for determining what to do should work for most cases:./
, assume that it is a Unix socket relative to the current directory. Traverse the path one element at a time until that socket is found, then dial it and use the remainder of the path for the request./
, assume that it is an absolute path to a Unix socket. Find it in the same was as for./
.!
, assume that separates a network type from an address. If it is a Unix network, find it in the same way as above. If it contains two!
, assume that the second separates a port number and replace it with a:
.:
or a!
and doesn't seem to point to an existing Unix socket, assume that the first element is a Plan 9 namespace and look it up as appropriate.The existing
parseAddr()
function can be reworked to have this functionality. That should simplify implementation and ensure consistency in how the dialing works.The text was updated successfully, but these errors were encountered: