Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
Revert "解耦文件内容"
Browse files Browse the repository at this point in the history
This reverts commit 2210363.
  • Loading branch information
rootphantomer committed Sep 2, 2022
1 parent 2210363 commit a162f93
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 277 deletions.
28 changes: 4 additions & 24 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: ph4nt0mer
* @Date: 2022-08-31 17:03:03
* @LastEditors: ph4nt0mer
* @LastEditTime: 2022-09-02 16:51:22
* @LastEditTime: 2022-09-02 15:51:36
* @FilePath: /quake_go/main.go
* @Description:
*
Expand All @@ -11,7 +11,6 @@
package main

import (
"encoding/json"
"flag"
"fmt"
"os"
Expand All @@ -20,12 +19,7 @@ import (
)

func main() {
test()

}

func Init() {
fmt.Println("Starting Quake Cli...")
Init()
var model, token, query, start, size string
flag.StringVar(&size, "size", "10", "size String value")
flag.StringVar(&start, "start", "0", "start String value")
Expand Down Expand Up @@ -71,20 +65,6 @@ Usage of ./quake_go:
}
}

type Server struct {
ServerName string // 首字母大写,首字母不敏感,其他字母敏感
ServerIP string // 首字母大写
}

type Serverslice struct {
Servers []Server
}

func test() {
var s Serverslice
str := `{"servers":[{"serverName":"Local_Web","serverIP":"127.0.0.1"},{"serverName":"Local_DB","serverIP":"127.0.0.1"}]}`
json.Unmarshal([]byte(str), &s)

// 输出转换后第一条
fmt.Println(s.Servers[0])
func Init() {
fmt.Println("Starting Quake Cli...")
}
23 changes: 0 additions & 23 deletions src/apis/AggregationServiceGet.go

This file was deleted.

23 changes: 0 additions & 23 deletions src/apis/AggregationServicePost.go

This file was deleted.

21 changes: 0 additions & 21 deletions src/apis/FaviconPost.go

This file was deleted.

13 changes: 0 additions & 13 deletions src/apis/FilterableServiceGET.go

This file was deleted.

22 changes: 0 additions & 22 deletions src/apis/InfoGet.go

This file was deleted.

19 changes: 0 additions & 19 deletions src/apis/ScrollServicePost.go

This file was deleted.

38 changes: 0 additions & 38 deletions src/apis/SearchServicePost.go

This file was deleted.

77 changes: 77 additions & 0 deletions src/apis/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* @Author: ph4nt0mer
* @Date: 2022-09-01 15:36:10
* @LastEditors: ph4nt0mer [email protected]
* @LastEditTime: 2022-09-01 22:55:24
* @FilePath: /quake_go/src/apis/api.go
* @Description:
*
* Copyright (c) 2022 by ph4nt0mer, All Rights Reserved.
*/
package apis

import (
"fmt"
"quake/src/setting"
"quake/src/tools"
)

func FilterableServiceGET(token string) {
// 获取服务数据筛选字段
// curl -X GET "https://quake.360.cn/api/v3/filterable/field/quake_service" -H "X-QuakeToken: d17140ae-xxxx-xxx-xxxx-c0818b2bbxxx"
uri := "/filterable/field/quake_service"
tools.ApisGet(setting.URL+uri, token)
}
func SearchServicePost(query string, start string, size string, token string) {
// 服务数据实时查询接口
// curl -X POST "https://quake.360.cn/api/v3/search/quake_service" -H "X-QuakeToken: d17140ae-xxxx-xxx-xxxx-c0818b2bbxxx" -H "Content-Type: application/json" -d '{
// "query": "service: http",
// "start": 20,
// "size": 10,
// "ignore_cache": false,
// "start_time": "2021-01-01 00:00:00",
// "end_time": "2021-02-01 00:00:00"
// }'
if query == "" || query == "?" {
fmt.Println("No query specified")
return
}
uri := "/search/quake_service"
payload := "{\"query\":\"" + query +
"\",\"start\":\"" + start + "\",\"size\":\"" + size +
"\"}"
tools.ApisPost(setting.URL+uri, payload, start, size, token)
}
func ScrollServicePost(query string, start string, size string, token string) {
// 服务数据深度查询接口
// curl -X POST "https://quake.360.cn/api/v3/scroll/quake_service" -H "X-QuakeToken: d17140ae-xxxx-xxx-xxxx-c0818b2bbxxx" -H "Content-Type: application/json" -d '{
// "query": "service: http",
// "size": 100,
// "ignore_cache": false,
// "start_time": "2021-01-07 00:13:14",
// "end_time": "2021-05-20 01:13:14"
// }'
uri := "/scroll/quake_service"
tools.ApisPost(setting.URL+uri, query, start, size, token)
}
func AggregationServiceGet(token string) {
// 获取聚合数据筛选字段
// curl -X GET "https://quake.360.cn/api/v3/aggregation/quake_service" -H "X-QuakeToken: d17140ae-xxxx-xxx-xxxx-c0818b2bbxxx"
uri := "/aggregation/quake_service"
tools.ApisGet(setting.URL+uri, token)
}
func AggregationServicePost(query string, start string, size string, token string) {
// 获取聚合数据筛选字段
// curl -X GET "https://quake.360.cn/api/v3/aggregation/quake_service" -H "X-QuakeToken: d17140ae-xxxx-xxx-xxxx-c0818b2bbxxx"
uri := "/aggregation/quake_service"
tools.ApisPost(setting.URL+uri, query, start, size, token)
}
func InfoGet(token string) {
// 个人信息接口
uri := "/user/info"
tools.ApisGet(setting.URL+uri, token)
}
func FaviconPost(query string, start string, size string, token string) {
uri := "/query/similar_icon/aggregation"
tools.ApisGet(setting.URL+uri, token)
}
18 changes: 0 additions & 18 deletions src/model/aggregation.go

This file was deleted.

48 changes: 0 additions & 48 deletions src/model/info.go

This file was deleted.

25 changes: 0 additions & 25 deletions src/model/search.go

This file was deleted.

Loading

0 comments on commit a162f93

Please sign in to comment.