{"id":13413638,"url":"https://github.com/yahoo/vssh","last_synced_at":"2025-05-16T07:07:53.347Z","repository":{"id":37745255,"uuid":"271051683","full_name":"yahoo/vssh","owner":"yahoo","description":"Go Library to Execute Commands Over SSH at Scale","archived":false,"fork":false,"pushed_at":"2023-12-07T19:54:32.000Z","size":291,"stargazers_count":965,"open_issues_count":6,"forks_count":83,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-12-31T07:28:20.129Z","etag":null,"topics":["automation","go","golang","network","server","ssh"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yahoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-06-09T16:19:22.000Z","updated_at":"2024-12-17T10:22:12.000Z","dependencies_parsed_at":"2024-01-08T15:34:49.730Z","dependency_job_id":null,"html_url":"https://github.com/yahoo/vssh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fvssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fvssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fvssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fvssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahoo","download_url":"https://codeload.github.com/yahoo/vssh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485064,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","go","golang","network","server","ssh"],"created_at":"2024-07-30T20:01:45.152Z","updated_at":"2025-05-16T07:07:48.336Z","avatar_url":"https://github.com/yahoo.png","language":"Go","readme":"# vSSH\n\nGo library to handle tens of thousands SSH connections and execute the command(s) with higher-level API for building network device / server automation. Documentation and examples are available via [godoc](https://godoc.org/github.com/yahoo/vssh).\n\n[![Test Status](https://github.com/yahoo/vssh/workflows/vSSH/badge.svg)](https://github.com/yahoo/vssh/actions?query=workflow%3AvSSH)\n[![Go Report Card](https://goreportcard.com/badge/github.com/yahoo/vssh)](https://goreportcard.com/report/github.com/yahoo/vssh)\n[![Coverage Status](https://coveralls.io/repos/github/yahoo/vssh/badge.svg?branch=master\u0026service=github1)](https://coveralls.io/github/yahoo/vssh?branch=master)\n[![GoDoc](https://godoc.org/github.com/yahoo/vssh?status.svg)](https://godoc.org/github.com/yahoo/vssh)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/yahoo/vssh?tab=doc)](https://pkg.go.dev/github.com/yahoo/vssh?tab=doc)\n\n![Alt text](/docs/imgs/vssh.png?raw=true \"vSSH\")\n\n## Features\n- Connect to multiple remote machines concurrently\n- Persistent SSH connection\n- DSL query based on the labels\n- Manage number of sessions per SSH connection\n- Limit amount of stdout and stderr data in bytes\n- Higher-level API for building automation\n\n### Sample query with label\n```go\nlabels := map[string]string {\n  \"POP\" : \"LAX\",\n  \"OS\" : \"JUNOS\",\n}\n// sets labels to a client\nvs.AddClient(addr, config, vssh.SetLabels(labels))\n// query with label\nvs.RunWithLabel(ctx, cmd, timeout, \"(POP == LAX || POP == DCA) \u0026\u0026 OS == JUNOS\")\n```\n\n### Basic example\n```go\nvs := vssh.New().Start()\nconfig := vssh.GetConfigUserPass(\"vssh\", \"vssh\")\nfor _, addr := range []string{\"54.193.17.197:22\", \"192.168.2.19:22\"} {\n  vs.AddClient(addr, config, vssh.SetMaxSessions(4))\n}\nvs.Wait()\n\nctx, cancel := context.WithCancel(context.Background())\ndefer cancel()\n\ncmd:= \"ping -c 4 192.168.55.10\"\ntimeout, _ := time.ParseDuration(\"6s\")\nrespChan := vs.Run(ctx, cmd, timeout)\n\nfor resp := range respChan {\n  if err := resp.Err(); err != nil {\n    log.Println(err)\n      continue\n    }\n\n  outTxt, errTxt, _ := resp.GetText(vs)\n  fmt.Println(outTxt, errTxt, resp.ExitStatus())\n}\n```\n\n### Stream example\n```go\nvs := vssh.New().Start()\nconfig, _ := vssh.GetConfigPEM(\"vssh\", \"mypem.pem\")\nvs.AddClient(\"54.193.17.197:22\", config, vssh.SetMaxSessions(4))\nvs.Wait()\n\nctx, cancel := context.WithCancel(context.Background())\ndefer cancel()\n\ncmd:= \"ping -c 4 192.168.55.10\"\ntimeout, _ := time.ParseDuration(\"6s\")\nrespChan := vs.Run(ctx, cmd, timeout)\n\nresp := \u003c- respChan\nif err := resp.Err(); err != nil {\n  log.Fatal(err)\n}\n\nstream := resp.GetStream()\ndefer stream.Close()\n\nfor stream.ScanStdout() {\n  txt := stream.TextStdout()\n  fmt.Println(txt)\n}\n```\n## Supported platform\n- Linux\n- Windows\n- Darwin\n- BSD\n- Solaris\n\n## License\nCode is licensed under the Apache License, Version 2.0 (the \"License\").\nContent is licensed under the CC BY 4.0 license. Terms available at https://creativecommons.org/licenses/by/4.0/.\n\n## Contribute\nWelcomes any kind of contribution, please follow the next steps:\n\n- Fork the project on github.com.\n- Create a new branch.\n- Commit changes to the new branch.\n- Send a pull request.\n","funding_links":[],"categories":["Networking","Go","网络相关库","网络","Relational Databases","Repositories"],"sub_categories":["Transliteration","Uncategorized","暂未分类","音译","暂未分类这些库被放在这里是因为其他类别似乎都不适合。"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Fvssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahoo%2Fvssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Fvssh/lists"}