hysteria-connect (646B)
1 #!/bin/sh 2 3 if test -z $1; then 4 echo "usage: $(basename $0) host [config]" 1>&2 5 exit 1 6 fi 7 8 if [ "$2" = "" ]; then 9 . "$HOME/.hysteria/config" 10 else 11 . "$2" 12 fi 13 14 tmux list-sessions -F '#S' 2>/dev/null | \ 15 grep "^$session$" >/dev/null 2>/dev/null 16 if [ $? -eq 1 ]; then 17 echo "no hysteria session \"$session\" running" 1>&2 18 exit 1 19 fi 20 21 host=$(printf '%s' "$1" | cut -d ':' -f 1) 22 port=$(printf '%s' "$1" | cut -s -d ':' -f 2) 23 [ "$port" = "" ] && port="6667" 24 mkdir -p "$ircdir/$host" 25 tmux new-window "ii -i $ircdir -s $host -p $port -n $nick -f $fullname | tee -a $ircdir/$host/log" 26 tmux rename-window "ii:$host" 27 hysteria-waitfile "$ircdir/$host/out"