ssh kitten: Start work on connection sharing

Basic sharing works. Now investigate if we can eliminate the round-trip
latency by transmitting the data without waiting for the start message
when using a shared connection
This commit is contained in:
Kovid Goyal
2022-03-09 19:27:38 +05:30
parent 38a70f5b51
commit 577de9f746
5 changed files with 48 additions and 6 deletions

View File

@@ -79,6 +79,12 @@ value are expanded. The default is empty so no changing is done, which
usually means the home directory is used.
''')
opt('share_connections', 'y', option_type='to_bool', long_text='''
Within a single kitty instance, all connections to a particular server can be
shared. This reduces startup latency for subsequent connections and means that you have
to enter the password only once. Under the hood, it uses SSH ControlMasters and
these are automatically cleaned up by kitty when it quits.
''')
opt('interpreter', 'sh', long_text='''
The interpreter to use on the remote host. Must be either a POSIX complaint shell

View File

@@ -2,7 +2,7 @@
import typing
from kittens.ssh.options.utils import copy, env, hostname, relative_dir
from kitty.conf.utils import merge_dicts
from kitty.conf.utils import merge_dicts, to_bool
class Parser:
@@ -30,6 +30,9 @@ class Parser:
def remote_dir(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['remote_dir'] = relative_dir(val)
def share_connections(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['share_connections'] = to_bool(val)
def shell_integration(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['shell_integration'] = str(val)

View File

@@ -12,6 +12,7 @@ option_names = ( # {{{
'interpreter',
'login_shell',
'remote_dir',
'share_connections',
'shell_integration') # }}}
@@ -21,6 +22,7 @@ class Options:
interpreter: str = 'sh'
login_shell: str = ''
remote_dir: str = '.local/share/kitty-ssh-kitten'
share_connections: bool = True
shell_integration: str = 'inherited'
copy: typing.Dict[str, kittens.ssh.copy.CopyInstruction] = {}
env: typing.Dict[str, str] = {}