add client and transport

This commit is contained in:
2025-10-19 13:05:29 +07:00
parent 729015c4ea
commit 6d1bf72d9d
9 changed files with 168 additions and 129 deletions
+15 -1
View File
@@ -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{