55 "errors"
66 "fmt"
77 "strconv"
8+ "time"
89
910 "github.com/nrdcg/porkbun"
1011 log "github.com/sirupsen/logrus"
@@ -68,11 +69,11 @@ func getRecords(ctx context.Context, domain, host string, client *porkbun.Client
6869 return & ipv4Record , & ipv6Record , nil
6970}
7071
71- func getPorkbunClients (credentials map [string ]PorkbunCredentials ) (map [string ]* porkbun.Client , error ) {
72+ func getPorkbunClients (credentials map [string ]PorkbunCredentials , timeout time. Duration ) (map [string ]* porkbun.Client , error ) {
7273 clients := make (map [string ]* porkbun.Client )
7374
7475 for key , credential := range credentials {
75- client , err := getPorkbunClient (credential , key )
76+ client , err := getPorkbunClient (credential , key , timeout )
7677 if err != nil {
7778 connectionErrorsTotal .Inc ()
7879 log .Errorf ("Error getting client for credentials '%s': %v" , key , err )
@@ -83,9 +84,9 @@ func getPorkbunClients(credentials map[string]PorkbunCredentials) (map[string]*p
8384 return clients , nil
8485}
8586
86- func getPorkbunClient (credentials PorkbunCredentials , credentialsName string ) (* porkbun.Client , error ) {
87+ func getPorkbunClient (credentials PorkbunCredentials , credentialsName string , timeout time. Duration ) (* porkbun.Client , error ) {
8788 client := porkbun .New (credentials .PorkbunSecretKey , credentials .PorkbunAPIKey )
88-
89+ client . HTTPClient . Timeout = timeout
8990 ctx := context .Background ()
9091
9192 yourIP , err := client .Ping (ctx )
0 commit comments