Nix 2.26.3
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 "sync.hh"
5#include "processes.hh"
6#include "file-system.hh"
7
8namespace nix {
9
10class SSHMaster
11{
12private:
13
14 const std::string host;
15 bool fakeSSH;
16 const std::string keyFile;
20 const std::string sshPublicHostKey;
21 const bool useMaster;
22 const bool compress;
23 const Descriptor logFD;
24
25 struct State
26 {
27#ifndef _WIN32 // TODO re-enable on Windows, once we can start processes.
28 Pid sshMaster;
29#endif
30 std::unique_ptr<AutoDelete> tmpDir;
31 Path socketPath;
32 };
33
34 Sync<State> state_;
35
36 void addCommonSSHOpts(Strings & args);
37 bool isMasterRunning();
38
39#ifndef _WIN32 // TODO re-enable on Windows, once we can start processes.
40 Path startMaster();
41#endif
42
43public:
44
45 SSHMaster(
46 std::string_view host,
47 std::string_view keyFile,
48 std::string_view sshPublicHostKey,
49 bool useMaster, bool compress, Descriptor logFD = INVALID_DESCRIPTOR);
50
52 {
53#ifndef _WIN32 // TODO re-enable on Windows, once we can start processes.
54 Pid sshPid;
55#endif
56 AutoCloseFD out, in;
57
68 void trySetBufferSize(size_t size);
69 };
70
78 std::unique_ptr<Connection> startCommand(
79 Strings && command,
80 Strings && extraSshArgs = {});
81};
82
83}
Definition file-descriptor.hh:152
Definition processes.hh:28
std::unique_ptr< Connection > startCommand(Strings &&command, Strings &&extraSshArgs={})
Definition ssh.cc:104
int Descriptor
Definition file-descriptor.hh:20
std::vector< Expr * > args
Definition lexer.l:6126
Definition ssh.hh:52
void trySetBufferSize(size_t size)
Definition ssh.cc:243
std::string Path
Definition types.hh:22