Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to skip verification of ssl certificates #227

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ By default, GoDNS uses `JSON` config file. However, you can specify to use the `
- `interval` — How often (in seconds) the public IP should be updated.
- `socks5_proxy` — Socks5 proxy server.
- `resolver` — Address of a public DNS server to use. For instance to use [Google's public DNS](https://developers.google.com/speed/public-dns/docs/using), you can set `8.8.8.8` when using GoDNS in IPv4 mode or `2001:4860:4860::8888` in IPv6 mode.
- `skip_ssl_verify` - Skip verification of ssl certificates for https requests.

### Update root domain

Expand Down
1 change: 1 addition & 0 deletions configs/config_sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"use_proxy": false,
"debug_info": false,
"proxied": false,
"skip_ssl_verify": false,
"notify": {
"telegram": {
"enabled": false,
Expand Down
1 change: 1 addition & 0 deletions configs/config_sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ip_interface: eth0
socks5_proxy:
use_proxy: false
debug_info: false
skip_ssl_verify: false
notify:
telegram:
enabled: false
Expand Down
1 change: 1 addition & 0 deletions internal/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ type Settings struct {
AppKey string `json:"app_key" yaml:"app_key"`
AppSecret string `json:"app_secret" yaml:"app_secret"`
ConsumerKey string `json:"comsumer_key" yaml:"comsumer_key"`
SkipSSLVerify bool `json:"skip_ssl_verify" yaml:"skip_ssl_verify"`
}

// LoadSettings -- Load settings from config file.
Expand Down
10 changes: 9 additions & 1 deletion internal/utils/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package utils

import (
"context"
"crypto/tls"
"net"
"net/http"
"time"
Expand Down Expand Up @@ -31,9 +32,16 @@ func GetHTTPClient(conf *settings.Settings) *http.Client {
return dialer.Dial(network, address)
}

httpTransport := &http.Transport{}
httpTransport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: conf.SkipSSLVerify},
}
client.Transport = httpTransport
httpTransport.DialContext = dialContext
} else {
httpTransport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: conf.SkipSSLVerify},
}
client.Transport = httpTransport
}

return client
Expand Down
Loading