add client and transport
This commit is contained in:
+15
-1
@@ -1,13 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"git.3crabs.ru/VLADIMIR/net/http"
|
||||
)
|
||||
|
||||
type CustomDNS struct{}
|
||||
|
||||
func (*CustomDNS) GetIP(domain string) (string, error) {
|
||||
if domain == "test.ru" {
|
||||
return "127.0.0.1:8081", nil
|
||||
}
|
||||
return "", errors.New("ip not found")
|
||||
}
|
||||
|
||||
func main() {
|
||||
r, err := http.Do(
|
||||
client := http.Client{
|
||||
DNS: &CustomDNS{},
|
||||
Transport: &http.HttpTransport{},
|
||||
}
|
||||
r, err := client.Do(
|
||||
"GET",
|
||||
"http://test.ru",
|
||||
[]http.Header{
|
||||
|
||||
Reference in New Issue
Block a user