Added socat wrapper for easy connection to SSL/ipv6 servers

This commit is contained in:
MadCamel
2018-04-14 11:22:03 -04:00
parent 2f910d1725
commit fe9226deaa
2 changed files with 43 additions and 0 deletions

View File

@@ -6,6 +6,9 @@ set ctimeout 60
;
; add some servers to the serverlist
;
; We don't currently support SSL or ipv6 but there's an easy workaround
; see socat.sh
servergroup undernet
server amsterdam.nl.eu.undernet.org 6663
server amsterdam2.nl.eu.undernet.org 6663

40
socat.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
# Simple wrapper that alows energymech to connect to SSL and/or ipv6 servers
# Run it before running energymech
# Listen port. In the energymech config put 'server localhost 6003'
LPORT=6003
# IRC server/port to connect to. This can be a hostname, ipv4, or ipv6 address
# Examples. Pick one.
# Freenode, with SSL and valid/signed server certificate
# Will prefer ipv6 if available
IRCSERVER=OPENSSL:irc.freenode.net:6697,pf=ip6
# Freenode, prefer ipv4
# IRCSERVER=OPENSSL:irc.freenode.net:6697,pf=ip4
# ipv4 server with self-signed SSL certificate
# Use this noverify option if you're having trouble with SSL..
# IRCSERVER=OPENSSL:69.132.46.1:6697,noverify
# Raw ipv6 address, no SSL
# IRCSERVER=TCP6:[2a01:128:79d:1::8]:6667
SOCAT=`which socat`
if [ -z "$SOCAT" ]; then
echo socat not found, please install it
echo On Debian: sudo apt-get install socat
echo On Redhat: sudo yum install socat
echo Or you can build it from source and add it to your \$PATH
exit 1
fi
PIDFILE=socat.pid
kill `cat $PIDFILE 2>/dev/null` >/dev/null 2>&1
${SOCAT} TCP4-LISTEN:${LPORT},reuseaddr,fork,bind=127.0.0.1 ${IRCSERVER} >socat.log 2>&1 </dev/null &
echo $! >$PIDFILE
echo running. Check socat.log if you are having problems