miguelfreitas / twister-seeder

twister dns seeder
51 stars 25 forks source link

listen to ipv6 #2

Open nitmir opened 9 years ago

nitmir commented 9 years ago

twister-seeder does not listen in ipv6 (or I have not been able to) so ipv6 only host won't be able to boostrap nodes from dns.

édit: as a dirty patch, I use socat UDP6-LISTEN:5355,fork,su=nobody,bind=[2001:41d0:2:98a0::5355] UDP4:127.0.0.1:5355 but native ipv6 would be great

nitmir commented 9 years ago

I use this init script to lauch socat and proxify ipv6 to ipv4 on twister-seeder

#!/bin/bash -e
### BEGIN INIT INFO
# Provides:          twister-seeder-ipv6
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     true
# Short-Description: Start/stop a gateway to ipv6 for twister dns seeder using socat
### END INIT INFO

# To start the script automatically at bootup type the following command
# update-rc.d twister-seeder defaults

NAME=twister-seeder-ipv6
DAEMON="/usr/bin/socat"
PIDFILE="/var/run/twister-seeder-ipv6.pid"

PORT=5355
IPV6="2001:41d0:2:98a0::5355"

ARGS="-T1 UDP6-LISTEN:$PORT,fork,su=nobody,bind=[$IPV6] UDP4:127.0.0.1:$PORT"

. /lib/lsb/init-functions

case $1 in
 start)
  #display to user that what is being started
  log_daemon_msg "Starting twister-seeder-ipv6"
  #start the process and record record it’s pid
  start-stop-daemon --start -b --pidfile "$PIDFILE" --make-pidfile --startas $DAEMON -- $ARGS
  #output failure or success
  #info on how to interact with the torrent
  RET=$?
  if [[ $RET -eq 0 ]]; then
   log_success_msg "The process started successfully"
  else
   log_failure_msg "The process failed to start"
  fi
  exit $RET
 ;;

 status)
    status_of_proc -p $PIDFILE $DAEMON $NAME
 ;;

 stop)
  #display that we are stopping the process
  log_daemon_msg "Stopping twister-seeder-ipv6"
  #stop the process using pid from start()
  start-stop-daemon --stop --pidfile "$PIDFILE" --retry 30
  #output success or failure
  RET=$?
  if [[ $RET -eq 0 ]]; then
   log_success_msg "The process stopped successfully"
  else
   log_failure_msg "The process failed to stop"
  fi
  exit $RET
 ;;

 restart)
    "$0" stop && "$0" start;
 ;;

 *)
  # show the options
   echo "Usage: {start|stop|restart}"
;;
esac