Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Bittorrent sync

cppgohan
December 22, 2013

Introduction to Bittorrent sync

2013.12 sztechparty

cppgohan

December 22, 2013
Tweet

More Decks by cppgohan

Other Decks in Technology

Transcript

  1. BitTorrent Sync 2013.01.24 PreAlpha ~ 2013.11.28 v1.2.82 Sync based on

    BitTorrent P2P protocal. between devices on local network between remote devices over the internet Sync files Folders Sync By its SECRET(a random string 20 bytes or more): Traffic is encrypted(AES-128) using a private key derived from the shared SECRET key.
  2. SECRET key: - Full Access Key - Read Only Key

    - OneTime SECRET key: - expired in 24hour - Full Access Key - Read Only Key - Encryption secret BitTorrent Sync
  3. Multiplatform support: ! • OS X Snow Leopard or newer

    • WinXP SP3 or newer, WinServer 2008 or newer • Linux kernel 2.6.16 or newer on ARM/PPC/i386/ x86_64 • FreeBSD 8.3 or newer • iOS 5.0 or newer • Android 2.2 or newer • NAS based on Linux kernel Using BitTorrent Sync
  4. Using BitTorrent Sync on Linux Server: ### 下载/解压 btsync(Linux_x86_64) !

    $ cd ~ && mkdir /etc/btsync $ cd /etc/btsync $ wget --content-disposition \ http://tinyurl.com/btsync-x86-64 $ tar zxvf btsync_glibc23_x64.tar.gz
  5. ### 导出默认配置到⽂文件 $ ./btsync --dump-sample-config > btsync.conf ! ### 配置btsync.conf,

    直接启动btsync $ vi btsync.conf ! ### 设置btsync元数据路径 storage_path: /etc/btsync/.btsync Using BitTorrent Sync on Linux Server:
  6. 两种⽤用法 webui / shared_folders, 彼此互斥: ! "webui": { "listen": "0.0.0.0:8888",

    "login": "admin", "password": "password@sztechparty" } Using BitTorrent Sync on Linux Server:
  7. Using BitTorrent Sync on Linux Server: ### 运⾏行进程 ./btsync --config

    btsync.conf ! Demo: http://btsync.baozishan.in WebUI
  8. "shared_folders": [{ "secret": "MY_SECRET_1", // 必填 "dir": "/home/user/bittorrent/sync_test", // 必填

    ! "use_relay_server": true, "use_tracker": true, "use_dht": false, "search_lan": true, "use_sync_trash": true, "known_hosts": [ "192.168.1.2:44444" ] }] Using BitTorrent Sync on Linux Server:
  9. "disk_low_priority": true, "rate_limit_local_peers": false, "folder_rescan_interval": 600, "sync_max_time_diff": 600, "lan_encrypt_data": true,

    "sync_trash_ttl": 30, "lan_use_tcp": false, "send_buf_size": 5, "max_file_size_diff_for_patching": 1000, "recv_buf_size": 5, "max_file_size_for_versioning": 1000 Using BitTorrent Sync on Linux Server:
  10. init.d script: gist: https://gist.github.com/MendelGusmao/5398362 ! #!/bin/sh ### BEGIN INIT INFO

    # Provides: btsync ... BTSYNC_USERS="mendel" DAEMON=/usr/bin/btsync ! start() { ... } stop() { ... } status() { ... } ! ... Using BitTorrent Sync on Linux Server:
  11. Introduction to BitTorrent Sync API step1. Register an API key

    step2. Enable API in Config file step3. Do the dirty work ! APIs: ! get_folders add_folder remove_folder get_files set_file_prefs get_folder_peers get_secrets get_folder_prefs set_folder_prefs get_folder_hosts set_folder_hosts get_prefs set_prefs get_os get_version get_speed shutdown
  12. Reality... FuckGFW! BitTorrent Sync Was Blocked by China GFW... this

    month Discuss: https://www.v2ex.com/t/90480