cdn.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. package v1
  2. type User struct {
  3. ID int64 `json:"id" form:"id"`
  4. Username string `json:"username" form:"username"`
  5. Password string `json:"password" form:"password"`
  6. Fullname string `json:"fullname" form:"fullname"`
  7. Mobile string `json:"mobile" form:"mobile"`
  8. Tel string `json:"tel" form:"tel"`
  9. Email string `json:"email" form:"email"`
  10. Remark string `json:"remark" form:"remark"`
  11. Source string `json:"source" form:"source"` // 用户来源
  12. NodeClusterId int64 `json:"nodeClusterId" form:"nodeClusterId"` // 节点集群ID
  13. }
  14. type Group struct {
  15. Name string `json:"name" form:"name"`
  16. }
  17. type Plan struct {
  18. UserId int64 `json:"userId" form:"userId"`
  19. PlanId int64 `json:"planId" form:"planId"`
  20. DayTo string `json:"dayTo" form:"dayTo"` // 结束日期,格式:YYYY-MM-DD,适用于按带宽和流量计费的套餐
  21. Period string `json:"period" form:"period"` // 周期类型:yearly、seasonally、monthly,适用于按时间周期计费的套餐
  22. CountPeriod int64 `json:"countPeriod" form:"countPeriod"` // 周期数量,适用于带宽和流量计费
  23. Name string `json:"name" form:"name"` // 备注名称
  24. IsFree bool `json:"isFree" form:"isFree"` // 可选项,是否免费
  25. PeriodDayTo string `json:"periodDayTo" form:"periodDayTo"` // 可选项, 按周期计费的套餐结束日期
  26. }
  27. type RenewalPlan struct {
  28. UserPlanId int64 `json:"userPlanId" form:"userPlanId"`
  29. DayTo string `json:"dayTo" form:"dayTo"` // 结束日期,格式:YYYY-MM-DD,适用于按带宽和流量计费的套餐
  30. Period string `json:"period" form:"period"` // 周期类型:yearly、seasonally、monthly,适用于按时间周期计费的套餐
  31. CountPeriod int64 `json:"countPeriod" form:"countPeriod"` // 周期数量,适用于带宽和流量计费
  32. IsFree bool `json:"isFree" form:"isFree"` // 可选项,是否免费
  33. PeriodDayTo string `json:"periodDayTo" form:"periodDayTo"` // 可选项, 按周期计费的套餐结束日期
  34. }
  35. type Website struct {
  36. UserId int64 `json:"userId" form:"userId"` //可选项,用户ID,如果不想指定用户,此值可以为0
  37. AdminId int64 `json:"adminId" form:"adminId"` //可选项,管理员ID
  38. Type string `json:"type" form:"type"` // 类型:httpProxy(HTTP反向代理,一般CDN服务都选这个)、httpWeb(静态文件服务,只会从服务器上读取文件内容,不会转发到源站)、tcpProxy(TCP反向代理)、udpProxy(UDP反向代理)
  39. Name string `json:"name" form:"name"` // 网站名称
  40. Description string `json:"description" form:"description"` // 可选项,网站描述
  41. ServerNamesJSON []byte `json:"serverNamesJSON,omitempty" form:"serverNamesJSON"` // 域名列表 json:server_names
  42. HttpJSON TypeJSON `json:"httpJSON,omitempty" form:"httpJSON"` // HTTP协议设置,当type为httpProxy或者httpWeb时填写 json:http_protocol
  43. HttpsJSON TypeJSON `json:"httpsJSON,omitempty" form:"httpsJSON"` // HTTPS协议设置,当type为httpProxy或者httpWeb时填写 json:https_protocol
  44. TcpJSON []byte `json:"tcpJSON,omitempty" form:"tcpJSON"` // TCP协议设置,当type为tcpProxy时填写 json:tcp_protocol
  45. TlsJSON []byte `json:"tlsJSON,omitempty" form:"tlsJSON"` // TLS协议设置,当type为tcpProxy时填写 json:tls_protocol
  46. UdpJSON []byte `json:"udpJSON,omitempty" form:"udpJSON"` // UDP协议设置,当type为udpProxy时填写 json:udp_protocol
  47. WebId int64 `json:"webId" form:"webId"` // 可选项,Web配置ID,当type为httpProxy或者httpWeb时填写,可以通过 /HTTPWebService/createHTTPWeb 接口创建;如果你需要配置缓存等信息时需要在 HTTPWebService 接口操作=
  48. ReverseProxyJSON []byte `json:"reverseProxyJSON,omitempty" form:"reverseProxyJSON"` // 反向代理(包含源站)配置引用,此项可以在创建网站后再设置 json:reverse_proxy_ref
  49. ServerGroupIds []int64 `json:"serverGroupIds" form:"serverGroupIds"` // 可选项,所属网站分组ID列表
  50. UserPlanId int64 `json:"userPlanId" form:"userPlanId"` // 可选项,套餐ID
  51. NodeClusterId int64 `json:"nodeClusterId" form:"nodeClusterId"` // 所部署的集群ID
  52. IncludeNodesJSON string `json:"includeNodesJSON" form:"includeNodesJSON"` // 备用参数,不用填写
  53. ExcludeNodesJSON string `json:"excludeNodesJSON" form:"excludeNodesJSON"` // 备用参数,不用填写
  54. }
  55. type WebsiteSend struct {
  56. UserId int64 `json:"userId" form:"userId"` //可选项,用户ID,如果不想指定用户,此值可以为0
  57. AdminId int64 `json:"adminId" form:"adminId"` //可选项,管理员ID
  58. Type string `json:"type" form:"type"` // 类型:httpProxy(HTTP反向代理,一般CDN服务都选这个)、httpWeb(静态文件服务,只会从服务器上读取文件内容,不会转发到源站)、tcpProxy(TCP反向代理)、udpProxy(UDP反向代理)
  59. Name string `json:"name" form:"name"` // 网站名称
  60. Description string `json:"description" form:"description"` // 可选项,网站描述
  61. ServerNamesJSON []byte `json:"serverNamesJSON,omitempty" form:"serverNamesJSON"` // 域名列表 json:server_names
  62. HttpJSON []byte `json:"httpJSON,omitempty" form:"httpJSON"` // HTTP协议设置,当type为httpProxy或者httpWeb时填写 json:http_protocol
  63. HttpsJSON []byte `json:"httpsJSON,omitempty" form:"httpsJSON"` // HTTPS协议设置,当type为httpProxy或者httpWeb时填写 json:https_protocol
  64. TcpJSON []byte `json:"tcpJSON,omitempty" form:"tcpJSON"` // TCP协议设置,当type为tcpProxy时填写 json:tcp_protocol
  65. TlsJSON []byte `json:"tlsJSON,omitempty" form:"tlsJSON"` // TLS协议设置,当type为tcpProxy时填写 json:tls_protocol
  66. UdpJSON []byte `json:"udpJSON,omitempty" form:"udpJSON"` // UDP协议设置,当type为udpProxy时填写 json:udp_protocol
  67. WebId int64 `json:"webId" form:"webId"` // 可选项,Web配置ID,当type为httpProxy或者httpWeb时填写,可以通过 /HTTPWebService/createHTTPWeb 接口创建;如果你需要配置缓存等信息时需要在 HTTPWebService 接口操作=
  68. ReverseProxyJSON []byte `json:"reverseProxyJSON,omitempty" form:"reverseProxyJSON"` // 反向代理(包含源站)配置引用,此项可以在创建网站后再设置 json:reverse_proxy_ref
  69. ServerGroupIds []int64 `json:"serverGroupIds" form:"serverGroupIds"` // 可选项,所属网站分组ID列表
  70. UserPlanId int64 `json:"userPlanId" form:"userPlanId"` // 可选项,套餐ID
  71. NodeClusterId int64 `json:"nodeClusterId" form:"nodeClusterId"` // 所部署的集群ID
  72. IncludeNodesJSON string `json:"includeNodesJSON" form:"includeNodesJSON"` // 备用参数,不用填写
  73. ExcludeNodesJSON string `json:"excludeNodesJSON" form:"excludeNodesJSON"` // 备用参数,不用填写
  74. }
  75. type TypeJSON struct {
  76. IsOn bool `json:"isOn" form:"isOn"` // 是否开启
  77. Listen []Listen `json:"listen" form:"listen"` // 监听端口
  78. SslPolicyRef SslPolicyRef `json:"sslPolicyRef" form:"sslPolicyRef"` // SSL策略
  79. }
  80. type Listen struct {
  81. Protocol string `json:"protocol" form:"protocol"` // 协议类型:tcp、udp
  82. Host string `json:"host" form:"host"` // 监听地址
  83. Port string `json:"portRange" form:"portRange"` // 端口
  84. }
  85. type SslPolicyRef struct {
  86. IsOn bool `json:"isOn" form:"isOn"` // 是否开启 isOn
  87. SslPolicyId int64 `json:"sslPolicyId" form:"sslPolicyId"` // SSL策略ID
  88. }
  89. type EditWebsite struct {
  90. Id int64 `json:"id" form:"id"`
  91. TypeJSON []byte `json:"typeJSON" form:"typeJSON"`
  92. }
  93. type ProxyJson struct {
  94. ServerId int64 `json:"serverId" form:"serverId"` // 网站ID
  95. JSON byte `json:"JSON" form:"JSON"` // TCP协议设置
  96. }
  97. type Origin struct {
  98. OriginId int64 `json:"originId" form:"originId"`
  99. Name string `json:"name" form:"name"` // 源站名称
  100. Addr Addr `json:"addr" form:"addr"` // 源站地址
  101. OssJSON []byte `json:"ossJSON" form:"ossJSON"` // Oss配置 json:oss_config
  102. Description string `json:"description" form:"description"` // 备注
  103. Weight int64 `json:"weight" form:"weight"` // 权重
  104. IsOn bool `json:"isOn" form:"isOn"` // 是否开启
  105. Domains []string `json:"domains" form:"domains"` // 域名
  106. CertRefJSON []byte `json:"certRefJSON" form:"certRefJSON"` // 证书引用,可选项
  107. Host string `json:"host" form:"host"` // 回源主机域名,可选项
  108. FollowPort bool `json:"followPort" form:"followPort"` // 是否跟随端口,可选项
  109. Http2Enabled bool `json:"http2Enabled" form:"http2Enabled"` //可选项,是否支持HTTP/2,只在HTTPS源站时生效
  110. TlsSecurityVerifyMode string `json:"tlsSecurityVerifyMode" form:"tlsSecurityVerifyMode"` // // 安全校验模式:auto系统默认,force强校验,skip不校验
  111. }
  112. type Addr struct {
  113. Protocol string `json:"protocol" form:"protocol"` // 协议类型:tcp、udp
  114. Host string `json:"host" form:"host"` // 监听地址
  115. Port string `json:"portRange" form:"portRange"` // 端口
  116. }
  117. type SSlCert struct {
  118. SslCertId int64 `json:"sslCertId" form:"sslCertId"`
  119. IsOn bool `json:"isOn" form:"isOn"` //是否开启
  120. UserId int64 `json:"userId" form:"userId"` //用户id
  121. Name string `json:"name" form:"name"` //证书名称
  122. Description string `json:"description" form:"description"` //证书描述
  123. ServerName string `json:"serverName" form:"serverName"` //证书绑定的域名
  124. IsCA bool `json:"isCA" form:"isCA"` //是否是CA证书
  125. CertData []byte `json:"certData" form:"certData"` //证书内容
  126. KeyData []byte `json:"keyData" form:"keyData"` //证书内容
  127. TimeBeginAt int64 `json:"timeBeginAt" form:"timeBeginAt"` //证书生效时间
  128. TimeEndAt int64 `json:"timeEndAt" form:"timeEndAt"` //证书失效时间
  129. DnsNames []string `json:"dnsNames" form:"dnsNames"` // 包含的DNS域名
  130. CommonNames []string `json:"commonNames" form:"commonNames"` // 包含的COMMON域名
  131. IsSelfSigned bool `json:"isSelfSigned" form:"isSelfSigned"` //是否是自签名证书
  132. }
  133. type EditServerNames struct {
  134. ServerId int64 `json:"serverId" form:"serverId"`
  135. ServerNamesJSON []byte `json:"serverNamesJSON" form:"serverNamesJSON"`
  136. }
  137. type AddSSLPolicy struct {
  138. Http2Enabled bool `json:"http2Enabled" form:"http2Enabled"` //是否支持HTTP/2
  139. Http3Enabled bool `json:"http3Enabled" form:"http3Enabled"` //是否支持Http3Enabled
  140. MinVersion string `json:"minVersion" form:"minVersion"` //最小TLS版本
  141. SslCertsJSON []byte `json:"sslCertsJSON" form:"sslCertsJSON"` //SslCertsJSON
  142. HstsJSON []byte `json:"hstsJSON" form:"hstsJSON"` //HstsJSON
  143. ClientAuthType int32 `json:"clientAuthType" form:"clientAuthType"` //可选项,客户端校验类型:0 无需证书,1 需要客户端证书,2 需要任一客户端证书,3 如果客户端上传了证书才校验,4 需要客户端证书而且需要校验
  144. CipherSuites []string `json:"cipherSuites" form:"cipherSuites"` //可选项,支持的TLS加密套件
  145. CipherSuitesIsOn bool `json:"cipherSuitesIsOn" form:"cipherSuitesIsOn"` //可选项,是否启用自定义加密套件
  146. OcspIsOn bool `json:"ocspIsOn" form:"ocspIsOn"` //可选项,是否开启OCSP
  147. }
  148. type SSLPolicy struct {
  149. SslPolicyId int64 `json:"sslPolicyId" form:"sslPolicyId"`
  150. Http2Enabled bool `json:"http2Enabled" form:"http2Enabled"` //是否支持HTTP/2
  151. Http3Enabled bool `json:"http3Enabled" form:"http3Enabled"` //是否支持Http3Enabled
  152. MinVersion string `json:"minVersion" form:"minVersion"` //最小TLS版本
  153. SslCertsJSON []byte `json:"sslCertsJSON" form:"sslCertsJSON"` //SslCertsJSON
  154. HstsJSON []byte `json:"hstsJSON" form:"hstsJSON"` //HstsJSON
  155. ClientAuthType int32 `json:"clientAuthType" form:"clientAuthType"` //可选项,客户端校验类型:0 无需证书,1 需要客户端证书,2 需要任一客户端证书,3 如果客户端上传了证书才校验,4 需要客户端证书而且需要校验
  156. CipherSuites []string `json:"cipherSuites" form:"cipherSuites"` //可选项,支持的TLS加密套件
  157. CipherSuitesIsOn bool `json:"cipherSuitesIsOn" form:"cipherSuitesIsOn"` //可选项,是否启用自定义加密套件
  158. OcspIsOn bool `json:"ocspIsOn" form:"ocspIsOn"` //可选项,是否开启OCSP
  159. }
  160. type SslCertsJSON struct {
  161. IsOn bool `json:"isOn" form:"isOn"`
  162. CertId int64 `json:"certId" form:"certId"`
  163. }
  164. type WebLog struct {
  165. IsPrior bool `json:"isPrior" form:"isPrior"`
  166. IsOn bool `json:"isOn" form:"isOn"`
  167. Fields []int64
  168. Status1 bool `json:"status1" form:"status1"`
  169. Status2 bool `json:"status2" form:"status2"`
  170. Status3 bool `json:"status3" form:"status3"`
  171. Status4 bool `json:"status4" form:"status4"`
  172. Status5 bool `json:"status5" form:"status5"`
  173. EnableClientClosed bool `json:"enableClientClosed" form:"enableClientClosed"`
  174. FirewallOnly bool `json:"firewallOnly" form:"firewallOnly"`
  175. }
  176. type CcConfig struct {
  177. IsOn bool `json:"isOn"`
  178. Level string `json:"level"`
  179. Action string `json:"action"`
  180. IsPrior bool `json:"isPrior"`
  181. Thresholds []struct {
  182. MaxRequests int `json:"maxRequests"`
  183. BlockSeconds int `json:"blockSeconds"`
  184. PeriodSeconds int `json:"periodSeconds"`
  185. } `json:"thresholds"`
  186. MinQPSPerIP int `json:"minQPSPerIP"`
  187. EnableGET302 bool `json:"enableGET302"`
  188. OnlyURLPatterns []interface{} `json:"onlyURLPatterns"`
  189. ThresholdMethod string `json:"thresholdMethod"`
  190. WithRequestPath bool `json:"withRequestPath"`
  191. EnableFingerprint bool `json:"enableFingerprint"`
  192. ExceptURLPatterns []interface{} `json:"exceptURLPatterns"`
  193. IgnoreCommonFiles bool `json:"ignoreCommonFiles"`
  194. IgnoreCommonAgents bool `json:"ignoreCommonAgents"`
  195. UseDefaultThresholds bool `json:"useDefaultThresholds"`
  196. }
  197. type WebSocket struct {
  198. WebsocketId int64 `json:"websocketId" form:"websocketId"`
  199. HandshakeTimeoutJSON []byte `json:"handshakeTimeoutJSON" form:"handshakeTimeoutJSON"`
  200. AllowAllOrigins bool `json:"allowAllOrigins" form:"allowAllOrigins"`
  201. AllowedOrigins []string `json:"allowedOrigins" form:"allowedOrigins"`
  202. RequestSameOrigin bool `json:"requestSameOrigin" form:"requestSameOrigin"`
  203. RequestOrigin string `json:"requestOrigin" form:"requestOrigin"`
  204. }
  205. type HandshakeTimeoutJSON struct {
  206. Unit string `json:"unit" form:"unit"`
  207. Count int `json:"count" form:"count"`
  208. }
  209. type AddWafPolicy struct {
  210. IsOn bool `json:"isOn" form:"isOn"`
  211. Name string `json:"name" form:"name"`
  212. Description string `json:"description" form:"description"`
  213. ServerId int64 `json:"serverId" form:"serverId"`
  214. ServerGroupId int64 `json:"serverGroupId" form:"serverGroupId"`
  215. }
  216. type Firewall struct {
  217. IsPrior bool `json:"isPrior" form:"isPrior"` // 是否覆盖上级配置
  218. IsOn bool `json:"isOn" form:"isOn"` // 是否启用配置
  219. FirewallPolicyId int64 `json:"firewallPolicyId" form:"firewallPolicyId"` // WAF策略ID
  220. IgnoreGlobalRules bool `json:"ignoreGlobalRules" form:"ignoreGlobalRules"` // 是否忽略系统定义的全局规则
  221. DefaultCaptchaType string `json:"defaultCaptchaType" form:"defaultCaptchaType"` // 默认人机识别方式,可以选none(不设置)、default(默认)、oneClick(单击验证)、slide(滑动解锁)、geetest(极验)
  222. }
  223. type IPListRequest struct {
  224. Type string `json:"type" form:"type"`
  225. Name string `json:"name" form:"name"`
  226. Code string `json:"code" form:"code"`
  227. TimeoutJSON []byte `json:"timeoutJSON" form:"timeoutJSON"`
  228. IsPublic bool `json:"isPublic" form:"isPublic"`
  229. Description string `json:"description" form:"description"`
  230. IsGlobal bool `json:"isGlobal" form:"isGlobal"`
  231. ServerId int64 `json:"serverId" form:"serverId"`
  232. }
  233. type AddIpItem struct {
  234. IpItemId int64 `json:"ipItemId" form:"ipItemId"`
  235. IpListId int64 `json:"ipListId" form:"ipListId"` // 所属IP列表ID
  236. Value string `json:"value" form:"value"` // IP原始值,比如单个IP、IP范围或者CIDR,指定了原始值后,无需设置ipFrom和ipTo两个参数
  237. IpFrom string `json:"ipFrom" form:"ipFrom"` // 开始IP
  238. IpTo string `json:"ipTo" form:"ipTo"` // 结束IP(可选)
  239. ExpiredAt int64 `json:"expiredAt" form:"expiredAt"` // 过期时间戳(可选)
  240. Reason string `json:"reason" form:"reason"` // 加入理由(可选)
  241. Type string `json:"type" form:"type"` // IP类型,值为ipv4或ipv6
  242. EventLevel string `json:"eventLevel" form:"eventLevel"` // 级别:debug, notice, warning, error, critical, fatal
  243. NodeId int64 `json:"nodeId" form:"nodeId"` // 可选项,所属节点ID(如果大于0,则不应用于其他节点)
  244. ServerId int64 `json:"serverId" form:"serverId"` // 可选项,所属网站ID(如果大于0,则不应用于其他网站)
  245. SourceNodeId int64 `json:"sourceNodeId" form:"sourceNodeId"` // 可选项,来源节点
  246. SourceServerId int64 `json:"sourceServerId" form:"sourceServerId"` // 可选项,来源网站ID
  247. SourceHTTPFirewallPolicyId int64 `json:"sourceHTTPFirewallPolicyId" form:"sourceHTTPFirewallPolicyId"` // 可选项,来源WAF策略ID
  248. SourceHTTPFirewallRuleGroupId int64 `json:"sourceHTTPFirewallRuleGroupId" form:"sourceHTTPFirewallRuleGroupId"` // 可选项,来源WAF规则分组ID
  249. SourceHTTPFirewallRuleSetId int64 `json:"sourceHTTPFirewallRuleSetId" form:"sourceHTTPFirewallRuleSetId"` // 可选项,来源WAF规则集ID
  250. SourceURL string `json:"sourceURL" form:"sourceURL"` // 可选项,来源URL
  251. SourceUserAgent string `json:"sourceUserAgent" form:"sourceUserAgent"` // 可选项,来源UA
  252. SourceCategory string `json:"sourceCategory" form:"sourceCategory"` // 分类:cc:CC防御
  253. }