-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodel.py
More file actions
37 lines (29 loc) · 720 Bytes
/
model.py
File metadata and controls
37 lines (29 loc) · 720 Bytes
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
# coding=utf-8
from peewee import *
from playhouse.sqlite_ext import SqliteExtDatabase
db = SqliteExtDatabase('proxy.db')
db.connect()
class BaseModel(Model):
class Meta:
database = db
class Proxy(BaseModel):
PROTOCOL_HTTP = 'http'
PROTOCOL_SOCKS5 = 'socks5'
# 透明代理
TYPE_TRANSPARENT = 'transparent'
# 匿名代理
TYPE_ANONYMOUS = 'anonymous'
# 高匿代理
TYPE_ELITE = 'elite'
ip = CharField()
port = IntegerField()
protocol = CharField()
type = CharField()
# 最后验证时间
check_time = DateTimeField()
class Meta:
indexes = (
(('ip', 'port'), True),
)
def create():
db.create_tables([Proxy])