toxcore
C Tox core wrapper
Wraps a native library — check OS Compatibility below for platform-specific linking notes.
Summary
| Latest Version | Unknown |
|---|---|
| License | GPL-3.0 |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install toxcore
choosenim install toxcore
git clone https://git.sr.ht/~ehmry/nim-toxcore
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| toxcore | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://git.sr.ht/~ehmry/nim-toxcore |
|---|---|
| Homepage | https://git.sr.ht/~ehmry/nim-toxcore |
| Documentation | View Documentation |
| Registry Source | nimble_official |
README
Nim wrapper over the Toxcore library
import toxcore
from std/os import sleep
const
bootstrapHost = "85.143.221.42"
bootstrapKey = "DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43".toPublicKey
type Bot = ref object
tox: Tox
proc setupCallbacks(bot: Bot) =
var echoCount = 0
# bind a value for callback closure magic
bot.tox.onFriendRequest do (pk: PublicKey; msg: string):
discard bot.tox.addFriendNoRequest(pk)
bot.tox.onFriendMessage do (f: Friend; msg: string; kind: MessageType):
discard bot.tox.send(f, msg, kind)
inc echoCount
bot.tox.statusMessage = $echoCount & " echos served "
proc newEchoBot(name: string): Bot =
result = Bot(tox: initTox())
result.tox.name = name
result.setupCallbacks()
result.tox.bootstrap(bootstrapHost, bootstrapKey)
echo result.tox.name, " echos messages to ", result.tox.address
let
a = newEchoBot "alice"
b = newEchoBot "bob"
while true:
iterate a.tox
iterate b.tox
sleep min(a.tox.iterationInterval, b.tox.iterationInterval)