amnextking / wallproxy-plus

Automatically exported from code.google.com/p/wallproxy-plus
2 stars 0 forks source link

感觉原来的代码设置比较快啊 #213

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
# -*- coding: utf-8 -*-

# 
新手请在此文件基础上进行设置;以#开头的行是注释,用于�
��明及示范如何配置
# 
默认监听地址为127.0.0.1:8086(可使用GUI托盘左键菜单或者AutoPr
oxy等设置给浏览器)
# 
首次运行后生成cert目录,导入cert/_ca.crt为浏览器根证书可消�
��SSL警告

server_type = 'gaeproxy'

# 
指定你申请的appid,例如'myappid',多个app用|分隔,想要使用��
�共的就保持为''
appid = 
'llxpeter495|ndfs2011|ndfs2012|ndfs2013|ndfs2014|ndfs2015|ndfs2016|ndfs2017|ndfs
2018'
#appid = 'appid1|appid2|appid3'

# 
如果你修改了密码,在下一行指定,例如'123456',多个app用|��
�隔
password = ''
#password = 'pwd1|pwd2|pwd3'

# 
如果你修改了加密模式,在下一行指定,例如'AES-CBC-32',多��
�app用|分隔
crypto = 'XOR--32'
#crypto = 'XOR--32|XOR--32|XOR--32'

# 
设置多个app后访问某些网站可能有问题,可以在这里指定哪��
�网站只使用一个app
onlyone = ''
#onlyone = 'example1.com|www.example2.com|www.www.example2.com'

# 访问日志输出位置(''不输出 None输出到终端 
'filename.log'输出到文件),重新运行后生效
output = None

# 
自定义.appspot.com的ip,如果启用,hosts中设置将无效,且不会�
��动切换https
gaehost_http = 
'203.208.46.22|203.208.46.177|203.208.46.178|203.208.46.179|203.208.46.1|203.208
.46.2|203.208.46.3|203.208.46.4|203.208.46.5|203.208.46.6|203.208.46.7|203.208.4
6.8|203.208.37.22|203.208.37.184|203.208.39.22|203.208.39.184|203.208.46.174|203
.208.46.175|203.208.46.176'
gaehost_https = 
'74.125.71.125|74.125.71.44|74.125.71.60|74.125.71.141|74.125.71.113|74.125.71.1
05|74.125.71.35|74.125.71.84|74.125.71.37|74.125.71.163'

# 自定义hosts,与hosts文件格式相同,建议保持默认
hosts = '''
www.google.cn .appspot.com
#ipv6.google.com .appspot.com
'''

# 是否强制使用https(True|False),建议False,速度更快
https = False

# 是否使用AutoProxy插件(True|False),建议True
pac = False

# 新手设置到此为止

# 数据包收发参数
# range0为下载大文件时每appid前2包大小,
# range为下载大文件时普通包大小,
# max_threads为大文件下载时最大进程数,
# headers不建议修改
# proxy为用于访问GAE的地址,
#  格式:
#   'proxy': 'http://www.google.cn:80',
#   'proxy': 'https://www.google.com:443',
#   'proxy': 'http://203.208.46.22:80',
#   'proxy': 'http://[2404:6800:8005::68]:80',
#  以上演示了域名、ipv4、ipv6、http、https访问方式,
#  另外proxy参数修改后会覆盖gaehost_http和gaehost_https
#  建议手动将proxy参数修改至最稳定且ping最低的连接方式

gae_extra_option = {
    #'range0': 100000,
    #'range': 500000,
    #'max_threads': 1000,
    #'headers': 'Content-Type: application/octet-stream',
    #'proxy': '',
}

server_extra_option = {
    #'listen': ('127.0.0.1', 8086),
    #'keep_alive': True,
}

# 
如果需要用PHP版弥补GAE不足,在此设置(此时GAE服务端不能��
�forold)
#forold = [{'proxy':'', 'url':'http://xxxx/fetch.php',}]
#plugins['plugins.forold'] = 'forold'

if appid:
    if isinstance(crypto, basestring): crypto += '|'*20
    if isinstance(password, basestring): password += ('|'+password)*20
    app = zip(*(app.split('|') if isinstance(app, basestring) else app
                for app in (appid, crypto, password)))
    gaeproxy = []; https = 'https' if https else 'http'
    for appid,crypto,password in app:
        appid = {'url': '%s://%s.appspot.com/%s.py' % (https, appid, server_type)}
        if crypto: appid['crypto'] = crypto
        appid['key'] = password
        gaeproxy.append(appid)
    gaeproxy[0].update(gae_extra_option)
    gaeproxy[0].setdefault('proxy', '')
    del plugins['plugins.gaeproxy'], app
    plugins['plugins.'+server_type] = 'gaeproxy'
    if find_http_handler.__name__ == 'default_find_http_handler':
        def find_http_handler(method, url, headers):
            if use_onlyone(url.hostname): return gaeproxy[0]
            return gaeproxy
if 'gaehost_http' in vars() and isinstance(gaehost_http, basestring) and not 
(https == 'https'):
    gaehost_http = gaehost_http and gaehost_http.split('|') or None
else:
    gaehost_http = None
if 'gaehost_https' in vars() and isinstance(gaehost_https, basestring) and not 
(https == 'http'):
    gaehost_https = gaehost_https and gaehost_https.split('|') or None
else:
    gaehost_https = None
if isinstance(onlyone, basestring):
    onlyone = onlyone and onlyone.split('|') or []
onlyone_domain = set(onlyone)
server['log_file'] = output
server.update(server_extra_option)
if not pac: del plugins['plugins.autoproxy']
elif 'listen' in server:
    pac = autoproxy[0].pop('PROXY 127.0.0.1:8086; DIRECT')
    autoproxy[0]['PROXY %s:%s; DIRECT' % server['listen']] = ((pac[0][0], 'http://%s:%s' % server['listen']), pac[1])
del (server_type, appid, password, crypto, onlyone, output, https, pac,
     gae_extra_option, server_extra_option)

#格式备忘,99%的人请无视:验证用户有效性,如果仅供个人�
��用,return True即可
# ip: client ip
# reqtype: http/https/socks4/socks5
# args: (method, url, headers) for http
# args: (host, port, headers) for https
# args: (cmd, ip, port, userid) for socks4
# args: (cmd, ip, port, username, password) for socks5
# please return True if client user is valid else False
#def check_client(ip, reqtype, args):
#    return True

Original issue reported on code.google.com by pppeter...@gmail.com on 24 Oct 2012 at 10:46

GoogleCodeExporter commented 9 years ago
新旧版不兼容

Original comment by www.eh...@gmail.com on 25 Oct 2012 at 2:01

GoogleCodeExporter commented 9 years ago
Moved to: Issue wallproxy:255

Original comment by wwqgtxx on 2 Dec 2012 at 2:48