File tree 3 files changed +78
-0
lines changed
3 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM msoap/shell2http
2
+
3
+ ARG CONFDIR=/config
4
+ ENV CONFDIR=${CONFDIR}
5
+ COPY config ${CONFDIR}
6
+
7
+ COPY pac.sh /usr/local/bin/pac.sh
8
+ RUN chmod -R +x /usr/local/bin
9
+
10
+ ENV PORT=8080
11
+
12
+ ENV DEFAULTCONFIG=default
13
+
14
+ ENTRYPOINT /app/shell2http -form -no-index -export-vars=CONFDIR -port ${PORT} \
15
+ /proxy.pac 'CONFIG=${v_conf} IP=${v_ip} PORT=${v_port} pac.sh'
16
+
Original file line number Diff line number Diff line change
1
+ example.org
2
+ example.net
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ if [[ -z ${IP} ]]
4
+ then
5
+
6
+ IP=" proxy"
7
+
8
+ fi
9
+
10
+ if [[ -z ${PORT} ]]
11
+ then
12
+
13
+ PORT=3128
14
+
15
+ fi
16
+
17
+ if [[ -z ${CONF} ]]
18
+ then
19
+
20
+ CONF=${DEFAULTCONFIG}
21
+
22
+ fi
23
+
24
+ CONF=${CONFDIR} /${CONF% .txt} .txt
25
+
26
+ echo "
27
+ function FindProxyForURL( url, host )
28
+ {
29
+
30
+ var proxyserver = \" ${IP} :${PORT} \" ;
31
+
32
+ var proxylist = new Array(
33
+ "
34
+
35
+ while read DOMAIN
36
+ do
37
+
38
+ [ -z " $DOMAIN " ] && continue
39
+
40
+ echo " '${DOMAIN} ',"
41
+
42
+ done < ${CONF}
43
+
44
+ echo " );"
45
+
46
+ echo "
47
+ for (var i = 0; i < proxylist.length; i++)
48
+ {
49
+ var value = proxylist[i];
50
+
51
+ if (shExpMatch(host, value))
52
+ {
53
+ return \" PROXY \" +proxyserver;
54
+ }
55
+ }
56
+
57
+ return " DIRECT" ;
58
+ }
59
+ "
60
+
You can’t perform that action at this time.
0 commit comments