When a monotone client initiates a netsync connection, these hooks are called to attempt to parse the host argument provided on the command line. If the hooks fail or return nil, monotone will interpret the host argument as a network name (possibly with a port number) and open a TCP socket.
get_netsync_connect_command (
uri,
args)
uri["scheme"]
, such as "ssh"
or "file"
uri["user"]
, the name of a remote user
uri["host"]
, the name or address of a remote host
uri["port"]
, a network port number
uri["path"]
, a filesystem path
uri["query"]
, for additional parameters
uri["fragment"]
, to describe a sub-location within the remote resource
The args argument is a table containing between 0 and 3 components:
args["include"]
, the branch pattern to include
args["exclude"]
, the branch pattern to exclude
args["debug"]
, whether to run the connection in debug mode
The default definition of this hook follows:
function get_netsync_connect_command(uri, args) local argv = nil if uri["scheme"] == "ssh" and uri["host"] and uri["path"] then argv = { "ssh" } if uri["user"] then table.insert(argv, "-l") table.insert(argv, uri["user"]) end if uri["port"] then table.insert(argv, "-p") table.insert(argv, uri["port"]) end table.insert(argv, uri["host"]) end if uri["scheme"] == "file" and uri["path"] then argv = { } end if argv then table.insert(argv, get_mtn_command(uri["host"])) if args["debug"] then table.insert(argv, "--debug") else table.insert(argv, "--quiet") end table.insert(argv, "--db") table.insert(argv, uri["path"]) table.insert(argv, "serve") table.insert(argv, "--stdio") table.insert(argv, "--no-transport-auth") if args["include"] then table.insert(argv, args["include"]) end if args["exclude"] then table.insert(argv, "--exclude") table.insert(argv, args["exclude"]) end end return argv end
use_transport_auth (
uri)
true
. The form of
the uri argument is a table, identical to the table provided as
an argument to get_netsync_connect_command
.
Note that the return value of this hook must "match" the semantics of
the command returned by get_netsync_connect_command
. In
particular, if this hook returns false
, the serve
command line arguments passed to the remote end of the connection
should include the --no-transport-auth option. A mismatch
between this hook's return value and the command line returned by
get_netsync_connect_command
will cause a communication failure,
as the local and remote monotone processes will have mismatched
authentication assumptions.
function use_transport_auth(uri) if uri["scheme"] == "ssh" or uri["scheme"] == "file" then return false else return true end end
get_mtn_command(
host)
function get_mtn_command(host) return "mtn" end