summaryrefslogtreecommitdiff
path: root/modules/caddytls
diff options
context:
space:
mode:
authorKallyDev <36319157+kallydev@users.noreply.github.com>2021-09-30 01:17:48 +0800
committerGitHub <noreply@github.com>2021-09-29 11:17:48 -0600
commitc48fadc4a7655008d13076c7f757c36368e2ca13 (patch)
tree3fe2837e02e9b664dd5b86afbe42494ac20997f8 /modules/caddytls
parent059fc32f002d00e980b438b3edbdf7b8bcdf9a90 (diff)
Move from deprecated ioutil to os and io packages (#4364)
Diffstat (limited to 'modules/caddytls')
-rw-r--r--modules/caddytls/acmeissuer.go4
-rw-r--r--modules/caddytls/connpolicy.go4
-rw-r--r--modules/caddytls/fileloader.go6
-rw-r--r--modules/caddytls/folderloader.go3
4 files changed, 8 insertions, 9 deletions
diff --git a/modules/caddytls/acmeissuer.go b/modules/caddytls/acmeissuer.go
index 9a7e73c..42cef02 100644
--- a/modules/caddytls/acmeissuer.go
+++ b/modules/caddytls/acmeissuer.go
@@ -18,8 +18,8 @@ import (
"context"
"crypto/x509"
"fmt"
- "io/ioutil"
"net/url"
+ "os"
"strconv"
"time"
@@ -152,7 +152,7 @@ func (iss *ACMEIssuer) Provision(ctx caddy.Context) error {
if len(iss.TrustedRootsPEMFiles) > 0 {
iss.rootPool = x509.NewCertPool()
for _, pemFile := range iss.TrustedRootsPEMFiles {
- pemData, err := ioutil.ReadFile(pemFile)
+ pemData, err := os.ReadFile(pemFile)
if err != nil {
return fmt.Errorf("loading trusted root CA's PEM file: %s: %v", pemFile, err)
}
diff --git a/modules/caddytls/connpolicy.go b/modules/caddytls/connpolicy.go
index 6c7fe3f..65cda5f 100644
--- a/modules/caddytls/connpolicy.go
+++ b/modules/caddytls/connpolicy.go
@@ -19,7 +19,7 @@ import (
"crypto/x509"
"encoding/base64"
"fmt"
- "io/ioutil"
+ "os"
"strings"
"github.com/caddyserver/caddy/v2"
@@ -369,7 +369,7 @@ func (clientauth *ClientAuthentication) ConfigureTLSConfig(cfg *tls.Config) erro
caPool.AddCert(clientCA)
}
for _, pemFile := range clientauth.TrustedCACertPEMFiles {
- pemContents, err := ioutil.ReadFile(pemFile)
+ pemContents, err := os.ReadFile(pemFile)
if err != nil {
return fmt.Errorf("reading %s: %v", pemFile, err)
}
diff --git a/modules/caddytls/fileloader.go b/modules/caddytls/fileloader.go
index fdf5486..430932b 100644
--- a/modules/caddytls/fileloader.go
+++ b/modules/caddytls/fileloader.go
@@ -17,7 +17,7 @@ package caddytls
import (
"crypto/tls"
"fmt"
- "io/ioutil"
+ "os"
"github.com/caddyserver/caddy/v2"
)
@@ -59,11 +59,11 @@ type CertKeyFilePair struct {
func (fl FileLoader) LoadCertificates() ([]Certificate, error) {
certs := make([]Certificate, 0, len(fl))
for _, pair := range fl {
- certData, err := ioutil.ReadFile(pair.Certificate)
+ certData, err := os.ReadFile(pair.Certificate)
if err != nil {
return nil, err
}
- keyData, err := ioutil.ReadFile(pair.Key)
+ keyData, err := os.ReadFile(pair.Key)
if err != nil {
return nil, err
}
diff --git a/modules/caddytls/folderloader.go b/modules/caddytls/folderloader.go
index 10b017e..0ff0629 100644
--- a/modules/caddytls/folderloader.go
+++ b/modules/caddytls/folderloader.go
@@ -19,7 +19,6 @@ import (
"crypto/tls"
"encoding/pem"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -79,7 +78,7 @@ func (fl FolderLoader) LoadCertificates() ([]Certificate, error) {
}
func x509CertFromCertAndKeyPEMFile(fpath string) (tls.Certificate, error) {
- bundle, err := ioutil.ReadFile(fpath)
+ bundle, err := os.ReadFile(fpath)
if err != nil {
return tls.Certificate{}, err
}