{"id":38762797,"url":"https://github.com/astranet/astranet","last_synced_at":"2026-01-17T11:58:40.710Z","repository":{"id":57491301,"uuid":"92958494","full_name":"astranet/astranet","owner":"astranet","description":"Go package for managing highly concurrent independent network streams.","archived":false,"fork":false,"pushed_at":"2019-08-23T08:54:37.000Z","size":246,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-09T21:37:39.528Z","etag":null,"topics":["astranet","go","golang","independent-data-streams","multiplexer","service-discovery"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astranet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-31T15:05:59.000Z","updated_at":"2019-09-09T11:33:40.000Z","dependencies_parsed_at":"2022-08-29T20:31:43.591Z","dependency_job_id":null,"html_url":"https://github.com/astranet/astranet","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/astranet/astranet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astranet%2Fastranet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astranet%2Fastranet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astranet%2Fastranet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astranet%2Fastranet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astranet","download_url":"https://codeload.github.com/astranet/astranet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astranet%2Fastranet/sbom","scorecard":{"id":213472,"data":{"date":"2025-08-11","repo":{"name":"github.com/astranet/astranet","commit":"edc0cc614b2554aae7364a3926e82d255d2957d6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T01:10:52.021Z","repository_id":57491301,"created_at":"2025-08-17T01:10:52.021Z","updated_at":"2025-08-17T01:10:52.021Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T11:50:55.898Z","status":"ssl_error","status_checked_at":"2026-01-17T11:50:55.569Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["astranet","go","golang","independent-data-streams","multiplexer","service-discovery"],"created_at":"2026-01-17T11:58:40.020Z","updated_at":"2026-01-17T11:58:40.662Z","avatar_url":"https://github.com/astranet.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AstraNet\n\n`astranet` is a package for managing highly concurrent independent network streams.\n\n## Authors\n\n1. https://github.com/biinilya\n2. https://github.com/xlab\n\n## How did we get here\n\nWhile dealing with everyday issues we have approached a situation when we need a huge amount of simultaneous independent data streams between two group of machines. The number was much higher than the standard TCP stack allows to have, even with sys limits tweaked in the right way.\n\nWe have checked every existing piece of software we could find to handle this issue, however they all seemed to be insufficient in some way; at the end it has been concluded that there is nothing to choose from, so we decided to roll our own.\n\nSo, `astranet` has been created. It does have some extra features as well:\n\n* Millions of independent data streams between two host machines using one tcp connection only;\n* Keep-alive frames to be sure the connections are alive;\n* NAT traversal capabilities for connecting any two machines without direct route between them using a trusted relay;\n* An embedded service discovery system;\n\nAs much as possible, the astranet package strives to look and feel just like the standard library's `net` package.\nThe only thing you'd need to do is setup an astranet instance like this:\n\n```go\nvar astraNet = astranet.New()\n```\n\nAn instance conforms this interface:\n\n```go\ntype AstraNet interface {\n    Dial(network string, hp string) (net.Conn, error)\n    DialTimeout(network string, hp string, t time.Duration) (net.Conn, error)\n    Bind(network string, hp string) (net.Listener, error)\n\n    Attach(conn io.ReadWriter)\n    ListenAndServe(network, address string) error\n    Join(network, address string) error\n    Services() []ServiceId\n    Routes() []ServiceId\n    ServiceMap() *RegistryStorage\n    RoutesMap() *RegistryStorage\n\n    WithEnv(env ...string) AstraNet\n    WithLoopBack() AstraNet\n    Client() AstraNet\n    Server() AstraNet\n    New() AstraNet\n\n    HttpDial(net, host string) (net.Conn, error)\n}\n```\n\n### Client\n\nHere's how you'd initiate a new client connection to some known astranet service:\n\n```go\nconn, err := astraNet.Dial(\"\", \"astranet_host:astranet_port\")\n```\n\nWhere `astranet_host` along with `astranet_port` are both \"virtual\" and are valid only inside an astranet network.\n\nOr as a more convenient way, the same using the embedded service discovery system:\n\n```go\nconn, err := astraNet.Dial(\"\", \"service_name\")\n```\n\nWhere `service_name` is the name a service used while registering on the network's registry.\n\n### Server\n\nTo bind a listener socket as a server:\n\n```go\nl, err := astraNet.Bind(\"\", \":astranet_port\"))\n```\n\nWhere `astranet_port` is a virtual port, but the behaviour is like it was a TCP listener.\n\nOr using the embedded service discovery system:\n\n```go\nl, err := astraNet.Bind(\"\", \"service_name\"))\n```\n\nWhere `service_name` is the name that will be used to register on a network's registry, so clients and other\nservers could do service lookups.\n\nYou can also use both service discovery and port systems together:\n\n```go\nl, err := astraNet.Bind(\"\", \"service_name:astranet_port\"))\n```\n\n#### Accepting streams\n\nThe listener returned is pretty much like the `net.Listener` one:\n\n```go\nfor {\n    conn, err := l.Accept()\n    go handleSession(conn)\n}\n```\n\nYou usually accept streams opened by the remote side as you would do with the regular `net` package:\n\n```go\nstream, err := service.Accept()\n```\n\nStreams satisfy the `net.Conn` interface, so they're very familiar to work with:\n    \n```go\nn, err = stream.Write(buf)\nn, err = stream.Read(buf)\n\nbuf := new(bytes.Buffer)\nio.Copy(buf, stream)\n```\n\n## Basics\n\nTo understand astranet better you should think of it as a P2P network with a flat namespace and forget about physical TCP routing stuff.\n\nEach astranet node receives a random `uint64` id that acts as a hostname. Each listener socket that binds to the astranet receives an `uint32` port for itself, that's pretty much like TCP.\n\nYou should establish a connection between two `astraNet` instances to make them visible to each other:\n\n```go\nvar astraNet1 = astraNet.New()\nvar astraNet2 = astraNet.New()\n\nastraNet1.ListenAndServe(\"tcp4\", \":10000\") // Wait for incoming astranet links on port 10000\nastraNet2.Join(\"tcp4\", \"127.0.0.1:10000\")  // Join the remote astranet instance\n// Gz! We are connected now\n```\n\nIn fact, an astranet instance can attach itself to any managed connection that supports the same capabilities as TCP (ordering, retransmissions, etc), or it could be just a loopback. Internally (in `ListenAndServe`) astranet manages TCP connections itself and does `Attach`. There is an example of a loopback connection:\n\n```go\nvar client, server IOLoop\nserver.Reader, client.Writer = io.Pipe()\nclient.Reader, server.Writer = io.Pipe()\n\n// Use IOLoops as a pipe that conforms io.ReadWriter on the both ends\ngo astraNet1.Attach(server)\ngo astraNet2.Attach(client)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastranet%2Fastranet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastranet%2Fastranet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastranet%2Fastranet/lists"}