Saturday, April 01, 2023

rtorrent/clash/ipfs/ipv6-dhcp

  • torrent
    • 基本概念
      • DHT
        • DHT其实就是去中心化(tracker list)的p2p网络。但是DHT需要bootstrapping node做为启动节点,否则无法找到其它DHT server
      • tracker list
        • tracker list包含了一系列的track server。track server可以看见所有的bt node. bt node也需要tracker server发现包含下载资源的node。tracker sever一般包含在torrent种子中,也可以手动在rtorrent下载界面中添加相关tracer server。 
    • rtorrent
      • 基本配置可以参考rtorrent@archlinux wiki.
      • 需要注意的是rtorrent无法做到server and client mode。如果rtorrent做为daemon运行,除非利用XMLRPC,否则无法通过client控制和查看daemon。所以只能通过screen实现headless运行,需要注意的是如果通过linux host远程到服务器端的rtorrent,则linux host段不能运行screeen,否则容易screen快捷键冲突。
      • rtorrent的DHT需要配置才能开启,另外需要添加bootstrapping DHT server,详细配置可见 link1 and link2
      • rtorrent的配置语法有点特别。"schedule2 = watch_directory_1,10,10,"load.start=~/Download/watch_stuff1/*.torrent"中的等号后面其实是schedule2命令的参数,这里并不是给schedule2赋值。如果函数没有参数,也需要加上等号。比如"dht.statistics="
      • 关键快捷键
        • ctrl+x: 输入命令
        • backspace/enter: 输入magnet link or torrent 
        • ctrl+q: 退出rtorrent
  • clash
    • clash其实只是一个proxy配置应用。clash可以有效的配置每个socket request该怎么分配到不同的proxy上。
    • proxy and proxy group其实就是proxy的集合,proxy group定义了该怎么选择proxy集合中的proxy。Android上clash里的proxy其实就是proxy group。
    • rule定义了如何将socket request mapping到proxy/proxy-group上。rule可以根据后缀,IP等不同方式分配不同的proxy。Android上的clash可以做到不同的app走不同的proxy。
    • rule provider其实其实一组rule的集合,但是它并不包含proxy target。Android clash里的Providers其实就是rule provider。
  • ipfs
    • ipfs其实和bitorrent都是p2p file sharing network。
    • ipfs把文件分成block(树状结构),文件的CID只是根节点的hash值,并不是整个文件的hash.
    • ipfs refs查看block,而不是整个文件。
  • ipv6 dhcp
    • ipv6 dhcp的概念和ipv4不太一样。ipv6有四种方式: Static (manual), SLAAC, Stateless DHCPv6, Stateful DCHPv6 。
    • iptables防火墙需要特殊设置才能enable ipv6. default ufw has related settting.
    • Following is just copy from link:
      • Static (manual) address assignment – exactly like with IPv4, you can go on and apply the address yourself. I believe this is straight forward and therefore I am not going to demonstrate that.
      • Stateless Address Auto Configuration (SLAAC) – nodes listen for ICMPv6 Router Advertisements (RA) messages periodically sent out by routers on the local link, or requested by the node using an RA solicitation message. They can then create a Global unicast IPv6 address by combining its interface EUI-64 (based on the MAC address on Ethernet interfaces) plus the Link Prefix obtained via the Router Advertisement. This is a unique feature only to IPv6 which provides simple “plug & play” networking. By default, SLAAC does not provide anything to the client outside of an IPv6 address and a default gateway. SLAAC is greatly discussed in RFC 4862.
      • Stateless DHCPv6 – with this option SLAAC is still used to get the IP address, but DHCP is used to obtain “other” configuration options, usually things like DNS, NTP, etc. The advantage here is that the DHCP server is not required to store any dynamic state information about any individual clients. In case of large networks which has huge number of end points attached to it, implementing stateless DHCPv6 will highly reduce the number of DHCPv6 messages that are needed for address state refreshment.
      • Stateful DCHPv6 – functions exactly the same as IPv4 DHCP in which hosts receive both their IPv6 address and additional parameters from the DHCP server. Like DHCP for IPv4, the components of a DHCPv6 infrastructure consist of DHCPv6 clients that request configuration, DHCPv6 servers that provide configuration, and DHCPv6 relay agents that convey messages between clients and servers when clients are on subnets that do not have a DHCPv6 server. You can learn more about DHCP for IPv6 in RFC 3315.

No comments: