浏览文件
agent_windows.go
22 行 · 415 B历史下载| 1 | //go:build windows |
| 2 | |
| 3 | package remotehost |
| 4 | |
| 5 | import ( |
| 6 | "context" |
| 7 | "github.com/Microsoft/go-winio" |
| 8 | "net" |
| 9 | "os" |
| 10 | "strings" |
| 11 | ) |
| 12 | |
| 13 | func dialAgent(ctx context.Context) (net.Conn, error) { |
| 14 | path := os.Getenv("SSH_AUTH_SOCK") |
| 15 | if path == "" { |
| 16 | path = `\\.\pipe\openssh-ssh-agent` |
| 17 | } |
| 18 | if strings.HasPrefix(path, `\\.\pipe\`) { |
| 19 | return winio.DialPipeContext(ctx, path) |
| 20 | } |
| 21 | return (&net.Dialer{}).DialContext(ctx, "unix", path) |
| 22 | } |

