forked from shadowsocks/shadowsocks-libev
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fejes Ferenc
committed
Feb 11, 2018
1 parent
0002a68
commit 690a3f9
Showing
5 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Alpine with China mirror | ||
FROM alpine | ||
MAINTAINER wener <[email protected]> | ||
|
||
# Better for cache and dev | ||
RUN apk add --no-cache --virtual .build-deps \ | ||
alpine-sdk cmake \ | ||
linux-headers libev-dev libsodium-dev mbedtls-static mbedtls-dev pcre-dev udns-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
set -e | ||
set -o xtrace | ||
|
||
cmake -DBUILD_STATIC=OFF . && make && make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
diff -ru shadowsocks-libev-orig/debian/shadowsocks-libev.default shadowsocks-libev/debian/shadowsocks-libev.default | ||
--- shadowsocks-libev-orig/debian/shadowsocks-libev.default 2017-06-02 08:45:07.000000000 +0800 | ||
+++ shadowsocks-libev/debian/shadowsocks-libev.default 2017-06-28 16:39:37.236474413 +0800 | ||
@@ -19,7 +19,7 @@ | ||
|
||
# User and group to run the server as | ||
USER=nobody | ||
-GROUP=nogroup | ||
+GROUP=nobody | ||
|
||
# Number of maximum file descriptors | ||
MAXFD=32768 | ||
diff -ru shadowsocks-libev-orig/debian/shadowsocks-libev.service shadowsocks-libev/debian/shadowsocks-libev.service | ||
--- shadowsocks-libev-orig/debian/shadowsocks-libev.service 2017-06-02 08:45:07.000000000 +0800 | ||
+++ shadowsocks-libev/debian/shadowsocks-libev.service 2017-06-28 17:23:55.131822730 +0800 | ||
@@ -6,7 +6,7 @@ | ||
# (at your option) any later version. | ||
# | ||
# This file is default for Debian packaging. See also | ||
-# /etc/default/shadowsocks-libev for environment variables. | ||
+# /etc/sysconfig/shadowsocks-libev for environment variables. | ||
|
||
[Unit] | ||
Description=Shadowsocks-libev Default Server Service | ||
@@ -15,9 +15,9 @@ | ||
|
||
[Service] | ||
Type=simple | ||
-EnvironmentFile=/etc/default/shadowsocks-libev | ||
+EnvironmentFile=/etc/sysconfig/shadowsocks-libev | ||
User=nobody | ||
-Group=nogroup | ||
+Group=nobody | ||
LimitNOFILE=32768 | ||
ExecStart=/usr/bin/ss-server -c $CONFFILE $DAEMON_ARGS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#!/bin/bash | ||
# | ||
# Script to run Shadowsocks in daemon mode at boot time. | ||
# ScriptAuthor: icyboy | ||
# Revision 1.0 - 14th Sep 2013 | ||
#==================================================================== | ||
# Run level information: | ||
# chkconfig: 2345 99 99 | ||
# Description: lightweight secured socks5 proxy | ||
# processname: ss-server | ||
# Author: Max Lv <[email protected]>; | ||
# Run "/sbin/chkconfig --add shadowsocks" to add the Run levels. | ||
#==================================================================== | ||
|
||
#==================================================================== | ||
# Paths and variables and system checks. | ||
|
||
# Source function library | ||
. /etc/rc.d/init.d/functions | ||
|
||
# Check that networking is up. | ||
# | ||
[ ${NETWORKING} ="yes" ] || exit 0 | ||
|
||
# Daemon | ||
NAME=shadowsocks-server | ||
DAEMON=/usr/bin/ss-server | ||
|
||
# Path to the configuration file. | ||
# | ||
CONF=/etc/shadowsocks-libev/config.json | ||
|
||
#USER="nobody" | ||
#GROUP="nobody" | ||
|
||
# Take care of pidfile permissions | ||
mkdir /var/run/$NAME 2>/dev/null || true | ||
#chown "$USER:$GROUP" /var/run/$NAME | ||
|
||
# Check the configuration file exists. | ||
# | ||
if [ ! -f $CONF ] ; then | ||
echo "The configuration file cannot be found!" | ||
exit 0 | ||
fi | ||
|
||
# Path to the lock file. | ||
# | ||
LOCK_FILE=/var/lock/subsys/shadowsocks | ||
|
||
# Path to the pid file. | ||
# | ||
PID=/var/run/$NAME/pid | ||
|
||
|
||
#==================================================================== | ||
|
||
#==================================================================== | ||
# Run controls: | ||
|
||
RETVAL=0 | ||
|
||
# Start shadowsocks as daemon. | ||
# | ||
start() { | ||
if [ -f $LOCK_FILE ]; then | ||
echo "$NAME is already running!" | ||
exit 0 | ||
else | ||
echo -n $"Starting ${NAME}: " | ||
#daemon --check $DAEMON --user $USER "$DAEMON -f $PID -c $CONF > /dev/null" | ||
daemon $DAEMON -u -c $CONF -f $PID | ||
fi | ||
|
||
RETVAL=$? | ||
[ $RETVAL -eq 0 ] && success | ||
echo | ||
[ $RETVAL -eq 0 ] && touch $LOCK_FILE | ||
return $RETVAL | ||
} | ||
|
||
|
||
# Stop shadowsocks. | ||
# | ||
stop() { | ||
echo -n $"Shutting down ${NAME}: " | ||
killproc -p ${PID} | ||
RETVAL=$? | ||
[ $RETVAL -eq 0 ] | ||
rm -f $LOCK_FILE | ||
rm -f ${PID} | ||
echo | ||
return $RETVAL | ||
} | ||
|
||
# See how we were called. | ||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
restart) | ||
stop | ||
start | ||
;; | ||
condrestart) | ||
if [ -f $LOCK_FILE ]; then | ||
stop | ||
start | ||
RETVAL=$? | ||
fi | ||
;; | ||
status) | ||
status $DAEMON | ||
RETVAL=$? | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|restart|condrestart|status}" | ||
RETVAL=1 | ||
esac | ||
|
||
exit $RETVAL |