bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
670 stars 133 forks source link

An option to force tcp connections to ipv4 only #54

Closed jsnjack closed 1 year ago

jsnjack commented 1 year ago

Description

This pr adds a new option to HttpClientOption called disableIPV6. If this option is set to true, the client will try to establish only tcp4 connections.

Motivation

We have noticed that go http client by default prefers to use ipv6 addresses over ipv4 addresses. We also noticed that for some reason ipv6 addresses from Hetzner have very bad reputation (their support team said that some of the geolocation services detect their ipv6 addresses as ip addresses from Iran) which results in 403 response code. With this option, it is possible to prefer ipv4 connections over ipv6 ones.

bogdanfinn commented 1 year ago

@jsnjack thank you for submitting this Pull Request. Due to another already merged pull request we have a conflict here now.

jsnjack commented 1 year ago

True! The conflict has been resolved