Documentation ¶
Index ¶
- Constants
- type ApiCtrl
- type AppCtrl
- type ContrllerBase
- type DomainsCtrl
- func (h DomainsCtrl) DeleteDomain()
- func (h DomainsCtrl) DeleteRecode()
- func (h DomainsCtrl) GetDomain()
- func (d DomainsCtrl) GetDomains()
- func (h DomainsCtrl) GetRecode()
- func (h DomainsCtrl) GetRecodes()
- func (h DomainsCtrl) NewDomain()
- func (h DomainsCtrl) NewRecode()
- func (h DomainsCtrl) UpdateDomain()
- func (h DomainsCtrl) UpdateRecode()
- type Downloader
- type JsonMap
- type SectionItem
- type SectionItems
Constants ¶
const ( PRoot = "/" PFiles = "/files" PRecodes = "/domain/:did/recodes" PRecode = "/recode/:rid" PLogin = "/login" PLogout = "/logout" PAbout = "/about" PDomains = "/domains" PDomain = "/domain/:did" PUpdate = "/update" PDownloads = "/downloads" PDownloadDel = "/download/del" PRRecodes = "/api/recodes" PDataversion = "/api/dataversion" PApiUpdate = "/api/update" )
const ( CodeOK = "ok" CodeInvalidSession = "InvalidSession" CodeDBError = "DBError" CodeUnknowError = "UnknowError" CodeInvalidParam = "InvalidParam" CodeRecodeExist = "RecodeExist" CodeKeyIsEmpty = "KeyIsEmpty" CodeInvalidIP = "InvalidIP" CodeNoAuthorization = "NoAuthorization" CodeAuthorizationError = "AuthorizationError" CodeVerifySignature = "VerifySignature" CodeGetSecretKeyError = "GetSecretKeyError" CodeUserNameError = "UserNameError" CodePasswordError = "PasswordError" CodeInvalidURL = "InvalidURL" )
const ( MwUserid = "UserID" MwSecretKey = "secretKey" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiCtrl ¶
type ApiCtrl struct {
ContrllerBase
}
func (ApiCtrl) ApiGetDataSchemaVersion ¶
func (a ApiCtrl) ApiGetDataSchemaVersion()
ApiGetDataSchemaVersion -> [POST] :/api/dataversion
Ret Code:[200]
成功返回值
{ "code": "OK", "version": "0.1" }
失败返回值
code: xxx
func (ApiCtrl) ApiGetRecodes ¶
func (a ApiCtrl) ApiGetRecodes()
ApiGetRecodes -> [POST] :/api/recodes
Ret Code:[200]
成功返回值
{ "code": "OK", "domains": [ { "id" : xxx, "domain": "xxxx", "recodes": [ { "id" : xxx, "value": "xxxx", "type": type, "name": "name" "ttl": xxx, "dynamic": true, "key": "xxxx" } ] } ] }
失败返回值
code: xxx
func (ApiCtrl) ApiUpdateRecode ¶
func (a ApiCtrl) ApiUpdateRecode()
ApiUpdateRecode -> [POST] :/api/update
Ret Code:[200]
更新一个记录
成功返回值
{ "result": "ok" }
失败返回值
{ "result": "xxx" }
type AppCtrl ¶
type AppCtrl struct {
ContrllerBase
}
func (AppCtrl) Login ¶
func (a AppCtrl) Login()
Login -> [POST] :/login?to=xxxx
Ret Code:[200]
成功返回值
{ "code": "OK" }
失败返回值
code: xxx
type ContrllerBase ¶
func (ContrllerBase) CookieAuthMiddleware ¶
func (h ContrllerBase) CookieAuthMiddleware()
func (ContrllerBase) HTML ¶
func (c ContrllerBase) HTML(code int, params JsonMap)
func (ContrllerBase) JSON ¶
func (c ContrllerBase) JSON(code int, data JsonMap)
func (ContrllerBase) SignMiddleware ¶
func (c ContrllerBase) SignMiddleware()
SignMiddleware 检查API签名 如果成功,会向context中写入secretkey字段
type DomainsCtrl ¶
type DomainsCtrl struct {
ContrllerBase
}
func (DomainsCtrl) DeleteDomain ¶
func (h DomainsCtrl) DeleteDomain()
DeleteDomain -> [DELETE] :/domain/:did
Ret Code:[200]
删除一个domain
成功返回值
{ "result": "ok" }
失败返回值
{ "result": "xxx" }
func (DomainsCtrl) DeleteRecode ¶
func (h DomainsCtrl) DeleteRecode()
DeleteRecode -> [DELETE] :/recode/:id
Ret Code:[200]
删除一条记录
成功返回值
{ "result": "ok" }
失败返回值
{ "result": "xxx" }
func (DomainsCtrl) GetDomains ¶
func (d DomainsCtrl) GetDomains()
GetDomains -> [GET] :/domains?r=true&offset=10&limit=0
Ret Code:[200]
[request=json] 获取指定区间的记录数 [request=html] 获取域名列表页面
成功返回值
{ "code": "OK" "domains" : [ "id": id, "domain"; "domain" ] }
失败返回值
code: xxx
func (DomainsCtrl) GetRecodes ¶
func (h DomainsCtrl) GetRecodes()
GetRecodes -> [GET] :/domain/:did/recodes
Ret Code:[200]
[request=json] 获取指定区间的记录数 [request=html] 获取记录列表页面
成功返回值
{ "code": "OK", "domainID": did, "domainName": "name", "recodes": [ { "id" : xxx, "host": "xxxx", "type": type "value": "xxxx" "ttl": xxx, "dynamic": true, "key": "xxxx", } ] }
失败返回值
code: xxx
func (DomainsCtrl) NewDomain ¶
func (h DomainsCtrl) NewDomain()
NewDomain -> [POST] :/domains
Ret Code:[200]
创建一个新的域名
成功返回值
{ "code": "OK", "id": newID, }
失败返回值
code: xxx
func (DomainsCtrl) NewRecode ¶
func (h DomainsCtrl) NewRecode()
NewRecode -> [POST] :/domain/:did/recodes
Ret Code:[200]
创建一条记录
成功返回值
{ "code": "OK", "id": newID, "key": "xxxx" }
失败返回值
code: xxx
func (DomainsCtrl) UpdateDomain ¶
func (h DomainsCtrl) UpdateDomain()
UpdateDomain -> [PATCH] :/domain/:did
Ret Code:[200]
更新一条记录
成功返回值
{ "result": "ok" }
失败返回值
{ "result": "xxx" }
func (DomainsCtrl) UpdateRecode ¶
func (h DomainsCtrl) UpdateRecode()
UpdateRecode -> [PATCH] :/recode/:rid
Ret Code:[200]
更新一条记录
成功返回值
{ "result": "ok" }
失败返回值
{ "result": "xxx" }
type Downloader ¶
type Downloader struct {
ContrllerBase
}
func (Downloader) Delete ¶
func (d Downloader) Delete()
Delete -> [POST] :/downloads
Ret Code:[200]
[request=json] 开始一个下载任务
成功返回值
{ "code": "OK", "id": id }
失败返回值
code: xxx
func (Downloader) GetDownloads ¶
func (d Downloader) GetDownloads()
GetDownloads -> [GET] :/downloads?r=true&offset=10&limit=0
Ret Code:[200]
[request=json] 获取指定区间的记录数 [request=html] 获取下载列表页面
成功返回值
{ "code": "OK" "tasks" : [ "id": id, "name": "name" "src": "src", "dest": "dest", "size": size, "Transferred": Transferred, "bytesPerSecond": bytesPerSecond ] }
失败返回值
code: xxx
func (Downloader) StartDownloads ¶
func (d Downloader) StartDownloads()
StartDownloads -> [POST] :/downloads?r=true&offset=10&limit=0
Ret Code:[200]
[request=json] 开始一个下载任务
成功返回值
{ "code": "OK", "id": id }
失败返回值
code: xxx
type SectionItem ¶
type SectionItems ¶
type SectionItems []*SectionItem