| 1234567891011121314151617181920212223242526272829303132333435 |
- package main
- import (
- "crypto/tls"
- "fmt"
- "github.com/xxjwxc/gowp/workpool"
- "io/ioutil"
- "net/http"
- )
- func main() {
- wp := workpool.New(2)
- client := &http.Client{}
- url := "https://192.168.31.220:9090/api/v2/check_pppoe_business?pppoe=025051670554"
- req, _ := http.NewRequest("GET", url, nil)
- req.Header.Set("Authorization", "Basic cWlhbnhpbkJhc2ljQXV0aDpxaWFueGluQmFzaWNBdXRoI0AhWlhDCg==")
- tr := &http.Transport{
- TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
- }
- for i := 0; i < 10; i++ {
- wp.Do(func() error {
- client := &http.Client{Transport: tr}
- resp, err := client.Get("https://localhost:8081")
- if err != nil {
- fmt.Println("error:", err)
- }
- defer resp.Body.Close()
- body, err := ioutil.ReadAll(resp.Body)
- fmt.Println(string(body))
- })
- }
- wp.Wait()
- }
|