订阅增加代理参数

This commit is contained in:
whyour
2022-11-13 23:58:42 +08:00
parent 5ee00e52a8
commit 0a6166c557
5 changed files with 25 additions and 3 deletions
+7 -1
View File
@@ -43,7 +43,13 @@ export default class SshKeyService {
host: string,
proxy?: string,
): string {
return `\nHost ${alias}\n Hostname ${host}\n IdentityFile ${this.sshPath}/${alias}\n StrictHostKeyChecking no\n`;
if (host === 'github.com' && proxy) {
host = 'ssh.github.com';
}
const proxyStr = proxy
? ` Port 443\n HostkeyAlgorithms +ssh-rsa\n PubkeyAcceptedAlgorithms +ssh-rsa\n ProxyCommand nc -v -x ${proxy} %h %p\n`
: '';
return `\nHost ${alias}\n Hostname ${host}\n IdentityFile ${this.sshPath}/${alias}\n StrictHostKeyChecking no\n${proxyStr}`;
}
private generateSshConfig(configs: string[]) {