Add merge command

This commit is contained in:
世界
2023-09-19 19:59:07 +08:00
parent a9743b77f6
commit e7b7ae811f
10 changed files with 198 additions and 16 deletions

View File

@@ -8,6 +8,7 @@ import (
"net"
"os"
"strconv"
"strings"
"sync"
"github.com/sagernet/sing-box/adapter"
@@ -76,10 +77,10 @@ func NewSSH(ctx context.Context, router adapter.Router, logger log.ContextLogger
if options.Password != "" {
outbound.authMethod = append(outbound.authMethod, ssh.Password(options.Password))
}
if options.PrivateKey != "" || options.PrivateKeyPath != "" {
if len(options.PrivateKey) > 0 || options.PrivateKeyPath != "" {
var privateKey []byte
if options.PrivateKey != "" {
privateKey = []byte(options.PrivateKey)
if len(options.PrivateKey) > 0 {
privateKey = []byte(strings.Join(options.PrivateKey, "\n"))
} else {
var err error
privateKey, err = os.ReadFile(os.ExpandEnv(options.PrivateKeyPath))