zeroSourceReadRandtls.config

type zeroSource struct{}


func (zeroSource) Read(b []byte) (n int, err error) {

    for i := range b {

        b[i] = 0

    }

    // assign the same key to b


    return len(b), nil

}


// server side

    server.TLS = &tls.Config{

        Rand: zeroSource{}, // for example only; don't do this.

    }


// client side

    client := &http.Client{

        Transport: &http.Transport{

            TLSClientConfig: &tls.Config{

                Rand:               zeroSource{}, // for reproducible output; don't do this.

            },

        },

    }