amnextking / wallproxy-plus

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

还是关于多个PAAS #75

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
接Issue 73

1. 暂不支持多个paas
2. paas单独代理需要改config.py:
PAAS = paas.PAAS(url='https://demo.app.com/', listen='8088', password='123456', 
proxy='http://127.0.0.1:8087/'

>>1,有计划支持多paas么?
>>2,能否在ini里添加个开关(利用GAE作桥的).比如Proxy = 1 
就自动在生成的config.py里添加proxy='http://127.0.0.1:8087/ 
这么一句能行吗?

然后感谢那个比较复杂的ini写法.如果默认就在配置说明里介�
��就好了.老版Wallproxy也是很多隐藏设置根本不知道搞半天很��
�时候设置都不顺手.

然后将来如果支持多PAAS的话能对应下多套paaslist么?因为想要�
��对不同的PAAS服务器写不同的paaslist.

PS:Issue关闭得太快啦.OTL

Original issue reported on code.google.com by kagami0...@hotmail.com on 14 Sep 2012 at 1:12

GoogleCodeExporter commented 9 years ago
忘了补充.

因为低费用的PAAS服务器有限速和流量.所以有时候需要类似老
版那样让两到三个PAAS服务器同时缓冲才能比较方便快速的做�
��理....于是对这方面希望能做做.OTL

Original comment by kagami0...@hotmail.com on 14 Sep 2012 at 1:29

GoogleCodeExporter commented 9 years ago
1. 
想起来了,PAAS是支持多个的,不支持同时设置多个网址,但�
��持产生多个PAAS实例(这点与GAE不同,GAE是单实例模式):
    PAAS1 = paas.PAAS(url='https://demo1.app.com/', listen='8088', password='123456', proxy='http://127.0.0.1:8087/')
    PAAS2 = paas.PAAS(url='https://demo2.app.com/', password='123456', proxy='http://127.0.0.1:8087/')
    PAAS0 = (PAAS1, PAAS2)
    from random import choice
    PAAS = lambda req: choice(PAAS0)(req)

[pac]
enable = 1
;file = proxy.pac
rulelist = !rulelist
py_default = GAE
default = DIRECT

[py_rulelist]
PAAS1 = paaslist1.ini
PAAS2 = paaslist2.ini
PAAS = paaslist.ini
这样就可以paaslist1.ini走PAAS1,paaslist2.ini走PAAS2,paaslist.ini在PA
AS1与PAAS2中随机选择一个。
这里PAAS2没有单独监听端口,所以无法通过PAC访问,你可以像
PAAS1那样单独监听端口例如8089,也可以按以下方法修改为PAAS1
与PAAS2共用8088端口:
    rulelist = (
        (RuleList(['paaslist1.ini']), PAAS1),
        (RuleList(['paaslist2.ini']), PAAS2),
    )
    def find_proxy_handler(req):
        proxy_type = req.proxy_type
        host, port = req.proxy_host
        if proxy_type.endswith('http'):
            url = req.url
            for rule,target in rulelist:
                if rule.match(url, host):
                    return target
            return PAAS
    paas.data['PAAS_server'].find_handler = find_proxy_handler
2. 以后更新时应该会加上吧;
3. 
这种复杂写法要求key必须与变量名一一对应,很容易出现NameE
rror错误,所以不会过多介绍;
4. 上面的示例代码已经支持不同paaslist对应不同PAAS了
5. PAAS暂不支持多线程

Original comment by www.eh...@gmail.com on 14 Sep 2012 at 4:40

GoogleCodeExporter commented 9 years ago
上面的rulelist、find_proxy_handler最好换个名称,例如:
    paaslist = (
        (RuleList(['paaslist1.ini']), PAAS1),
        (RuleList(['paaslist2.ini']), PAAS2),
    )
    def find_paas_handler(req):
        proxy_type = req.proxy_type
        host, port = req.proxy_host
        if proxy_type.endswith('http'):
            url = req.url
            for rule,target in paaslist:
                if rule.match(url, host):
                    return target
            return PAAS
    paas.data['PAAS_server'].find_handler = find_paas_handler
,总之就是写法与find_proxy_handler类似,但是是另外定义,而��
�是同一个,
最后也不是return 
find_paas_handler,而是paas.data['PAAS_server'].find_handler = 
find_paas_handler,
GAE的8087也可以这么改:paas.data['GAE_server'].find_handler = 
find_gae_handler

Original comment by www.eh...@gmail.com on 14 Sep 2012 at 4:48

GoogleCodeExporter commented 9 years ago
OAA不用支持多线程,只需要能多个并发就行了..

Original comment by kagami0...@hotmail.com on 15 Sep 2012 at 2:47

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

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