{"id":44405861,"url":"https://github.com/nknorg/nkn-tuna-session","last_synced_at":"2026-02-12T06:40:17.434Z","repository":{"id":41894078,"uuid":"235768459","full_name":"nknorg/nkn-tuna-session","owner":"nknorg","description":"An overlay peer to peer connection based on multiple concurrent tuna connections and ncp protocol.","archived":false,"fork":false,"pushed_at":"2024-11-21T01:03:34.000Z","size":183,"stargazers_count":7,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-15T06:10:15.582Z","etag":null,"topics":["network","nkn","p2p"],"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/nknorg.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-23T10:07:06.000Z","updated_at":"2024-11-21T01:03:38.000Z","dependencies_parsed_at":"2023-11-25T08:26:09.392Z","dependency_job_id":"b6b6ee84-cfe2-4c8a-a8ce-b387e7dfde84","html_url":"https://github.com/nknorg/nkn-tuna-session","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/nknorg/nkn-tuna-session","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nknorg%2Fnkn-tuna-session","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nknorg%2Fnkn-tuna-session/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nknorg%2Fnkn-tuna-session/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nknorg%2Fnkn-tuna-session/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nknorg","download_url":"https://codeload.github.com/nknorg/nkn-tuna-session/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nknorg%2Fnkn-tuna-session/sbom","scorecard":{"id":690268,"data":{"date":"2025-08-11","repo":{"name":"github.com/nknorg/nkn-tuna-session","commit":"4aa759c293c378cf8c4c3a47f09c104cff357764"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Code-Review","score":5,"reason":"Found 13/25 approved changesets -- score normalized to 5","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"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":"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":"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":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/nknorg/nkn-tuna-session/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/nknorg/nkn-tuna-session/go.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"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":"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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: Apache License 2.0: 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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2024-2611 / GHSA-8r3f-844c-mc37"],"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 30 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-22T02:09:37.445Z","repository_id":41894078,"created_at":"2025-08-22T02:09:37.446Z","updated_at":"2025-08-22T02:09:37.446Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29360644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["network","nkn","p2p"],"created_at":"2026-02-12T06:40:13.350Z","updated_at":"2026-02-12T06:40:17.425Z","avatar_url":"https://github.com/nknorg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NKN Tuna Session\n\nNKN Tuna Session is an overlay peer to peer connection based on multiple\nconcurrent [tuna](https://github.com/nknorg/tuna) connections and\n[ncp](https://github.com/nknorg/ncp-go) protocol.\n\nA few feature highlights:\n\n* Performance: Use multiple parallel paths to boost overall throughput.\n\n* Network agnostic: Neither dialer nor listener needs to have public IP address\n  or NAT traversal. They are guaranteed to be connected regardless of their\n  network conditions.\n\n* Security: Using public key as address, which enables built-in end to end\n  encryption while being invulnerable to man-in-the-middle attack.\n\nA simple illustration of a session between Alice and Bob:\n\n```\n        X\n      /   \\\nAlice - Y - Bob\n      \\   /\n        Z\n```\n\nListener (Bob for example) will pay relayers in the middle (X, Y, Z) for\nrelaying the traffic using NKN tokens. The payment will be based on bandwidth\nusage of the session.\n\n## Usage\n\nYou first need to import both `nkn-sdk-go` and `nkn-tuna-session`:\n\n```go\nimport (\n\tnkn \"github.com/nknorg/nkn-sdk-go\"\n\tts \"github.com/nknorg/nkn-tuna-session\"\n)\n```\n\nCreate a multi-client and wallet (see\n[nkn-sdk-go](https://github.com/nknorg/nkn-sdk-go) for details) or re-use your\nexisting ones:\n\n```go\nmulticlient, err := nkn.NewMultiClient(...)\n// wallet is only needed for listener side\nwallet, err := nkn.NewWallet(...)\n```\n\nThen you can create a tuna session client:\n\n```go\n// wallet is only needed for listener side and will be used for payment\n// price is in unit of NKN token per MB\nc, err := ts.NewTunaSessionClient(account, multiclient, wallet, \u0026ts.Config{TunaMaxPrice: \"0\"})\n```\n\nA tuna session client can start listening for incoming session where the remote\naddress match any of the given regexp:\n\n```go\n// Accepting any address, equivalent to c.Listen(nkn.NewStringArray(\".*\"))\nerr = c.Listen(nil)\n// Only accepting pubkey 25d660916021ab1d182fb6b52d666b47a0f181ed68cf52a056041bdcf4faaf99 but with any identifiers\nerr = c.Listen(nkn.NewStringArray(\"25d660916021ab1d182fb6b52d666b47a0f181ed68cf52a056041bdcf4faaf99$\"))\n// Only accepting address alice.25d660916021ab1d182fb6b52d666b47a0f181ed68cf52a056041bdcf4faaf99\nerr = c.Listen(nkn.NewStringArray(\"^alice\\\\.25d660916021ab1d182fb6b52d666b47a0f181ed68cf52a056041bdcf4faaf99$\"))\n```\n\nWait for tuna to connect:\n\n```go\n\u003c-c.OnConnect()\n```\n\nThen it can start accepting sessions:\n\n```go\nsession, err := c.Accept()\n```\n\nTuna session client implements `net.Listener` interface, so one can use it as a\ndrop-in replacement when `net.Listener` is needed, e.g. `http.Serve`.\n\nOn the other hand, any tuna session client can dial a session to a remote NKN\naddress:\n\n```go\nsession, err := c.Dial(\"another nkn address\")\n```\n\nSession implements `net.Conn` interface, so it can be used as a drop-in\nreplacement when `net.Conn` is needed:\n\n```go\nbuf := make([]byte, 1024)\nn, err := session.Read(buf)\nn, err := session.Write(buf)\n```\n\nA few more complicated examples can be found at [examples](examples)\n\n## Usage on iOS/Android\n\nThis library is designed to work with\n[gomobile](https://godoc.org/golang.org/x/mobile/cmd/gomobile) and run natively\non iOS/Android without any modification. You can use `gomobile bind` to compile\nit to Objective-C framework for iOS:\n\n```shell\ngomobile bind -target=ios -ldflags \"-s -w\" github.com/nknorg/nkn-tuna-session github.com/nknorg/nkn-sdk-go github.com/nknorg/ncp-go github.com/nknorg/tuna github.com/nknorg/nkngomobile\n```\n\nand Java AAR for Android:\n\n```shell\ngomobile bind -target=android -ldflags \"-s -w\" github.com/nknorg/nkn-tuna-session github.com/nknorg/nkn-sdk-go github.com/nknorg/ncp-go github.com/nknorg/tuna github.com/nknorg/nkngomobile\n```\n\n## Contributing\n\n**Can I submit a bug, suggestion or feature request?**\n\nYes. Please open an issue for that.\n\n**Can I contribute patches?**\n\nYes, we appreciate your help! To make contributions, please fork the repo, push\nyour changes to the forked repo with signed-off commits, and open a pull request\nhere.\n\nPlease sign off your commit. This means adding a line \"Signed-off-by: Name\n\u003cemail\u003e\" at the end of each commit, indicating that you wrote the code and have\nthe right to pass it on as an open source patch. This can be done automatically\nby adding -s when committing:\n\n```shell\ngit commit -s\n```\n\n## Community\n\n* [Discord](https://discord.gg/c7mTynX)\n* [Telegram](https://t.me/nknorg)\n* [Reddit](https://www.reddit.com/r/nknblockchain/)\n* [Twitter](https://twitter.com/NKN_ORG)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnknorg%2Fnkn-tuna-session","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnknorg%2Fnkn-tuna-session","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnknorg%2Fnkn-tuna-session/lists"}