ZanderCodes Logo

Hobby Developer, Streamer & Designer


Latest Posts

How to create an IPv6 request with Golang

on 10 Sep, 2020 by ZanderCodes

Creating an IPv6 request is relatively simple
You have to create a http.client with a custom transport

You only have to replace the DialContext with tcp6

Code example:

webClient := http.Client{
    Transport: &http.Transport{
        Proxy: http.ProxyFromEnvironment,
        DialContext: func(ctx context.Context, _, addr string) (net.Conn, error) {
            dialer := net.Dialer{}
            return dialer.DialContext(ctx, "tcp6", addr)
        MaxIdleConns:          100,
        IdleConnTimeout:       90 * time.Second,
        TLSHandshakeTimeout:   10 * time.Second,
... Read more!

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.