Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
ssh.hh
Go to the documentation of this file.
1#pragma once
3
4#include "nix/util/ref.hh"
5#include "nix/util/sync.hh"
6#include "nix/util/url.hh"
9
10namespace nix {
11
17const std::filesystem::path & sshProgram();
18
19OsStrings getNixSshOpts();
20
21class SSHMaster
22{
23private:
24
25 ParsedURL::Authority authority;
26 std::string hostnameAndUser;
27 bool fakeSSH;
28 const std::optional<std::filesystem::path> keyFile;
32 const std::string sshPublicHostKey;
33 const bool useMaster;
34 const bool compress;
35 const Descriptor logFD;
36
37 const ref<const AutoDelete> tmpDir;
38
39 struct State
40 {
41 Pid sshMaster;
42 std::filesystem::path socketPath;
43 };
44
45 Sync<State> state_;
46
47 void addCommonSSHOpts(OsStrings & args);
48 bool isMasterRunning();
49
50 std::filesystem::path startMaster();
51
52public:
53
54 SSHMaster(
55 const ParsedURL::Authority & authority,
56 std::optional<std::filesystem::path> keyFile,
57 std::string_view sshPublicHostKey,
58 bool useMaster,
59 bool compress,
60 Descriptor logFD = INVALID_DESCRIPTOR);
61
63 {
64 Pid sshPid;
65 AutoCloseFD out, in;
66
77 void trySetBufferSize(size_t size);
78 };
79
87 std::unique_ptr<Connection> startCommand(OsStrings && command, OsStrings && extraSshArgs = {});
88};
89
90} // namespace nix
Definition file-descriptor.hh:265
Definition processes.hh:39
std::unique_ptr< Connection > startCommand(OsStrings &&command, OsStrings &&extraSshArgs={})
Definition ssh.cc:161
Definition ref.hh:58
int Descriptor
Definition file-descriptor.hh:36
Utilities for working with the file system and file paths.
std::list< OsString > OsStrings
Definition os-string.hh:51
const std::filesystem::path & sshProgram()
Definition ssh.cc:62
Definition url.hh:32
Definition ssh.hh:63
void trySetBufferSize(size_t size)
Definition ssh.cc:297