-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathproxy.py
More file actions
43 lines (37 loc) · 1.23 KB
/
Copy pathproxy.py
File metadata and controls
43 lines (37 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding:utf-8 -*-
from ctypes import (
c_int,
c_ushort
)
from .wkeStruct import wkeProxy
class Proxy():
def __init__(self,miniblink):
self.mb=miniblink
def wkeSetProxy(self,ip,port,proxy_type=1,user=None,password=None):
if not all([ip,port]):return
if user==None:
user=b''
else:
user=user.encode('utf8')
if password==None:
password=b''
else:
password=password.encode('utf8')
ip=ip.encode('utf8')
port=int(port)
proxy= wkeProxy(type=c_int(proxy_type), hostname=ip, port=c_ushort(port),username=user,password=password)
self.mb.wkeSetProxy(proxy)
def wkeSetViewProxy(self,webview,ip,port,proxy_type=1,user=None,password=None):
if not all([ip,port]):return
if user==None:
user=b''
else:
user=user.encode('utf8')
if password==None:
password=b''
else:
password=password.encode('utf8')
ip=ip.encode('utf8')
port=int(port)
proxy= wkeProxy(type=c_int(proxy_type), hostname=ip, port=c_ushort(port),username=user,password=password)
self.mb.wkeSetViewProxy(webview,proxy)