├── .appveyor.yml ├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── COPYING ├── Cargo.lock ├── Cargo.toml ├── README.md ├── examples ├── dht_node.rs ├── tcp_client.rs └── tcp_server.rs ├── scripts ├── bootstrap-osx.sh ├── bootstrap-ubuntu-14-04.sh ├── deploy-gh-pages.sh └── verify-commit-messages.sh ├── src ├── lib.rs ├── toxcore │ ├── binary_io.rs │ ├── crypto_core.rs │ ├── dht.rs │ ├── dht_new │ │ ├── binary_io.rs │ │ ├── kbucket.rs │ │ ├── mod.rs │ │ ├── packed_node.rs │ │ └── packet.rs │ ├── dht_node.rs │ ├── hole_punching.rs │ ├── network.rs │ ├── packet_kind.rs │ ├── state_format │ │ ├── mod.rs │ │ └── old.rs │ ├── tcp │ │ ├── binary_io.rs │ │ ├── codec.rs │ │ ├── handshake │ │ │ ├── codec.rs │ │ │ ├── mod.rs │ │ │ └── packet.rs │ │ ├── mod.rs │ │ ├── packet.rs │ │ ├── secure.rs │ │ └── server │ │ │ ├── client.rs │ │ │ ├── mod.rs │ │ │ └── server.rs │ ├── timeout.rs │ └── toxid.rs ├── toxcore_tests │ ├── binary_io_tests.rs │ ├── crypto_core_tests.rs │ ├── dht_tests.rs │ ├── network_tests.rs │ ├── packet_kind_tests.rs │ ├── state_format_old_tests.rs │ ├── test_macros.rs │ └── toxid_tests.rs ├── toxencryptsave │ └── mod.rs └── toxencryptsave_tests │ ├── ciphertext │ └── encryptsave_tests.rs └── tests ├── load-state-format-old.rs ├── serialize-deserialize-state-format-old.rs └── state-format-old-data ├── profile-no-friends.tox └── profile-with-contacts.tox /.appveyor.yml: -------------------------------------------------------------------------------- 1 | # Thanks to https://github.com/starkat99/appveyor-rust 2 | 3 | os: Visual Studio 2015 4 | platform: Any CPU 5 | 6 | clone_depth: 1 7 | clone_folder: C:\projects\tox 8 | 9 | branches: 10 | except: 11 | - /test.*/ 12 | 13 | environment: 14 | matrix: 15 | - channel: stable 16 | target: x86_64-pc-windows-gnu 17 | # env variables for debugging 18 | RUST_BACKTRACE: "1" 19 | 20 | install: 21 | # install libsodium 22 | - mkdir deps && cd deps 23 | - appveyor DownloadFile https://download.libsodium.org/libsodium/releases/libsodium-1.0.13-mingw.tar.gz -FileName libsodium.tar.gz 24 | - 7z x libsodium.tar.gz -so | 7z x -si -ttar > nul 25 | - set SODIUM_STATIC=1 26 | - set SODIUM_LIB_DIR=C:\projects\tox\deps\libsodium-win64\lib 27 | - cd C:\projects\tox 28 | # install rustc & cargo 29 | - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe 30 | - rustup-init -yv --default-toolchain %channel% --default-host %target% 31 | - set PATH=%PATH%;%USERPROFILE%\.cargo\bin 32 | - rustc -vV 33 | - cargo -vV 34 | 35 | build: false 36 | 37 | test_script: 38 | - cargo build --verbose 39 | - cargo test --verbose 40 | 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Rust 2 | target/ 3 | .cargo/ 4 | 5 | # vim 6 | *.swp 7 | 8 | # git 9 | *.orig 10 | 11 | # other 12 | *.patch 13 | master.zip 14 | kcov/ 15 | 16 | # some scripts 17 | .*.sh 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | rust: 3 | - 1.21.0 4 | - stable 5 | - beta 6 | - nightly 7 | cache: 8 | - apt 9 | - cargo 10 | # needed for `cargo install cargo-travis` 11 | addons: 12 | apt: 13 | packages: 14 | - libcurl4-openssl-dev 15 | - libelf-dev 16 | - libdw-dev 17 | - binutils-dev 18 | - cmake 19 | sources: 20 | - kalakris-cmake 21 | 22 | os: 23 | - linux 24 | 25 | matrix: 26 | allow_failures: 27 | - rust: beta 28 | - rust: nightly 29 | - os: osx 30 | 31 | sudo: required 32 | 33 | env: 34 | global: 35 | - RUST_BACKTRACE=1 36 | 37 | branches: 38 | except: 39 | - /test.*/ 40 | 41 | notifications: 42 | irc: 43 | channels: "chat.freenode.net#zetox" 44 | template: 45 | - "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} || Change view: %{compare_url}" 46 | on_success: change 47 | skip_join: true 48 | 49 | before_install: 50 | - | 51 | if [[ "$TRAVIS_OS_NAME" == "linux" ]] 52 | then 53 | ./scripts/verify-commit-messages.sh "$TRAVIS_COMMIT_RANGE" \ 54 | && ./scripts/bootstrap-ubuntu-14-04.sh 55 | fi 56 | - | 57 | if [[ "$TRAVIS_OS_NAME" == "osx" ]] 58 | then 59 | ./scripts/bootstrap-osx.sh 60 | export PKG_CONFIG_PATH=$HOME/installed_libsodium/lib/pkgconfig:$PKG_CONFIG_PATH 61 | export LD_LIBRARY_PATH=$HOME/installed_libsodium/lib:$LD_LIBRARY_PATH 62 | fi 63 | 64 | script: 65 | - cargo build --verbose 66 | - cargo test --verbose 67 | - | 68 | if [[ "$TRAVIS_RUST_VERSION" == nightly ]] 69 | then 70 | cargo build --features "clippy" \ 71 | && cargo test --features "clippy" 72 | fi 73 | - cargo doc 74 | 75 | after_success: 76 | - > 77 | test $TRAVIS_PULL_REQUEST == "false" 78 | && (test $TRAVIS_BRANCH == "travis" 79 | || test $TRAVIS_BRANCH == "master" ) 80 | && bash ./scripts/deploy-gh-pages.sh 81 | # measure code coverage and upload to coveralls.io 82 | - | 83 | if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_RUST_VERSION" == stable ]] 84 | then 85 | cargo install cargo-travis || echo "cargo-travis has been already installed" 86 | export PATH=$HOME/.cargo/bin:$PATH 87 | cargo coveralls 88 | fi 89 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Tox 2 | 3 | We'd love for you to contribute to our source code and to make Tox even better than it is today! Here are the guidelines we'd like you to follow: 4 | 5 | - [Issues and Bugs](#issue) 6 | - [Coding Rules](#rules) 7 | - [Commit Guidelines](#commit) 8 | - [Submission Guidelines](#submit) 9 | 10 | ### Must read 11 | * Use **[commit message format](#commit-message-format)**. 12 | * Keep the title **short** and provide a **clear** description about what your pull request does. 13 | * Keep your git commit history **clean** and **precise**. Commits like `xxx fixup` should not appear. 14 | * If your commit fixes a reported issue (for example #4134), add the following message to the commit `Fixes #4134.`. 15 | 16 | 17 | 18 | ## Found an Issue? 19 | If you find a bug in the source code or a mistake in the documentation, you can help us by submitting an issue to our [GitHub Repository][github]. Even better, you can submit a Pull Request with a fix. 20 | 21 | 22 | 23 | ## Coding Rules 24 | To ensure consistency throughout the source code, keep these rules in mind as you are working: 25 | * All features or bug fixes **must be tested** by one or more tests. 26 | - Whenever possible, use property-based testing in addition to example-based testing. [QuickCheck](https://github.com/BurntSushi/quickcheck) helps with that. 27 | * All functions **must be documented**, *especially* APIs. 28 | 29 | * Preferably wrap all the code at **80 characters**, or max 100 if you have to. This is not a *hard* rule - just keep it sane. 30 | * Spaces, 4 of them for an indent level, no tabs. 31 | 32 | *This section needs to be improved - if you're interested in doing that, please do.* 33 | 34 | 35 | 36 | ## Git Commit Guidelines 37 | 38 | We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. But also, we use the git commit messages to **generate the Tox change log** using [clog-cli](https://github.com/clog-tool/clog-cli). 39 | 40 | 41 | ### Commit Message Format 42 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special 43 | format that includes a **type**, a **scope** and a **subject**: 44 | 45 | ``` 46 | (): 47 | 48 | 49 | 50 |