mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
Move from deprecated ioutil to os and io packages (#4364)
This commit is contained in:
parent
059fc32f00
commit
c48fadc4a7
26 changed files with 71 additions and 84 deletions
|
@ -1,6 +1,6 @@
|
||||||
linters-settings:
|
linters-settings:
|
||||||
errcheck:
|
errcheck:
|
||||||
ignore: fmt:.*,io/ioutil:^Read.*,go.uber.org/zap/zapcore:^Add.*
|
ignore: fmt:.*,go.uber.org/zap/zapcore:^Add.*
|
||||||
ignoretests: true
|
ignoretests: true
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
|
|
3
admin.go
3
admin.go
|
@ -26,7 +26,6 @@ import (
|
||||||
"expvar"
|
"expvar"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
|
@ -1202,7 +1201,7 @@ var (
|
||||||
// will get deleted before the process gracefully exits.
|
// will get deleted before the process gracefully exits.
|
||||||
func PIDFile(filename string) error {
|
func PIDFile(filename string) error {
|
||||||
pid := []byte(strconv.Itoa(os.Getpid()) + "\n")
|
pid := []byte(strconv.Itoa(os.Getpid()) + "\n")
|
||||||
err := ioutil.WriteFile(filename, pid, 0600)
|
err := os.WriteFile(filename, pid, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
7
caddy.go
7
caddy.go
|
@ -20,7 +20,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -300,7 +299,7 @@ func unsyncedDecodeAndRun(cfgJSON []byte, allowPersist bool) error {
|
||||||
zap.String("dir", dir),
|
zap.String("dir", dir),
|
||||||
zap.Error(err))
|
zap.Error(err))
|
||||||
} else {
|
} else {
|
||||||
err := ioutil.WriteFile(ConfigAutosavePath, cfgJSON, 0600)
|
err := os.WriteFile(ConfigAutosavePath, cfgJSON, 0600)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
Log().Info("autosaved config (load with --resume flag)", zap.String("file", ConfigAutosavePath))
|
Log().Info("autosaved config (load with --resume flag)", zap.String("file", ConfigAutosavePath))
|
||||||
} else {
|
} else {
|
||||||
|
@ -700,13 +699,13 @@ func ParseDuration(s string) (time.Duration, error) {
|
||||||
// have its own unique ID.
|
// have its own unique ID.
|
||||||
func InstanceID() (uuid.UUID, error) {
|
func InstanceID() (uuid.UUID, error) {
|
||||||
uuidFilePath := filepath.Join(AppDataDir(), "instance.uuid")
|
uuidFilePath := filepath.Join(AppDataDir(), "instance.uuid")
|
||||||
uuidFileBytes, err := ioutil.ReadFile(uuidFilePath)
|
uuidFileBytes, err := os.ReadFile(uuidFilePath)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
uuid, err := uuid.NewRandom()
|
uuid, err := uuid.NewRandom()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return uuid, err
|
return uuid, err
|
||||||
}
|
}
|
||||||
err = ioutil.WriteFile(uuidFilePath, []byte(uuid.String()), 0600)
|
err = os.WriteFile(uuidFilePath, []byte(uuid.String()), 0600)
|
||||||
return uuid, err
|
return uuid, err
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return [16]byte{}, err
|
return [16]byte{}, err
|
||||||
|
|
|
@ -17,7 +17,7 @@ package caddyfile
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -447,7 +447,7 @@ func (p *parser) doSingleImport(importFile string) ([]Token, error) {
|
||||||
return nil, p.Errf("Could not import %s: is a directory", importFile)
|
return nil, p.Errf("Could not import %s: is a directory", importFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
input, err := ioutil.ReadAll(file)
|
input, err := io.ReadAll(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, p.Errf("Could not read imported file %s: %v", importFile, err)
|
return nil, p.Errf("Could not read imported file %s: %v", importFile, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ package caddyfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -280,7 +279,7 @@ func TestRecursiveImport(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// test relative recursive import
|
// test relative recursive import
|
||||||
err = ioutil.WriteFile(recursiveFile1, []byte(
|
err = os.WriteFile(recursiveFile1, []byte(
|
||||||
`localhost
|
`localhost
|
||||||
dir1
|
dir1
|
||||||
import recursive_import_test2`), 0644)
|
import recursive_import_test2`), 0644)
|
||||||
|
@ -289,7 +288,7 @@ func TestRecursiveImport(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer os.Remove(recursiveFile1)
|
defer os.Remove(recursiveFile1)
|
||||||
|
|
||||||
err = ioutil.WriteFile(recursiveFile2, []byte("dir2 1"), 0644)
|
err = os.WriteFile(recursiveFile2, []byte("dir2 1"), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -314,7 +313,7 @@ func TestRecursiveImport(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// test absolute recursive import
|
// test absolute recursive import
|
||||||
err = ioutil.WriteFile(recursiveFile1, []byte(
|
err = os.WriteFile(recursiveFile1, []byte(
|
||||||
`localhost
|
`localhost
|
||||||
dir1
|
dir1
|
||||||
import `+recursiveFile2), 0644)
|
import `+recursiveFile2), 0644)
|
||||||
|
@ -370,7 +369,7 @@ func TestDirectiveImport(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(directiveFile, []byte(`prop1 1
|
err = os.WriteFile(directiveFile, []byte(`prop1 1
|
||||||
prop2 2`), 0644)
|
prop2 2`), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -633,7 +632,7 @@ func TestSnippets(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeStringToTempFileOrDie(t *testing.T, str string) (pathToFile string) {
|
func writeStringToTempFileOrDie(t *testing.T, str string) (pathToFile string) {
|
||||||
file, err := ioutil.TempFile("", t.Name())
|
file, err := os.CreateTemp("", t.Name())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err) // get a stack trace so we know where this was called from.
|
panic(err) // get a stack trace so we know where this was called from.
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ import (
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -230,7 +230,7 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
|
||||||
return nil, h.ArgErr()
|
return nil, h.ArgErr()
|
||||||
}
|
}
|
||||||
filename := h.Val()
|
filename := h.Val()
|
||||||
certDataPEM, err := ioutil.ReadFile(filename)
|
certDataPEM, err := os.ReadFile(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,9 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/caddyserver/caddy/v2"
|
"github.com/caddyserver/caddy/v2"
|
||||||
|
@ -95,7 +96,7 @@ func (hl HTTPLoader) LoadConfig(ctx caddy.Context) ([]byte, error) {
|
||||||
return nil, fmt.Errorf("server responded with HTTP %d", resp.StatusCode)
|
return nil, fmt.Errorf("server responded with HTTP %d", resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -144,7 +145,7 @@ func (hl HTTPLoader) makeClient(ctx caddy.Context) (*http.Client, error) {
|
||||||
if len(hl.TLS.RootCAPEMFiles) > 0 {
|
if len(hl.TLS.RootCAPEMFiles) > 0 {
|
||||||
rootPool := x509.NewCertPool()
|
rootPool := x509.NewCertPool()
|
||||||
for _, pemFile := range hl.TLS.RootCAPEMFiles {
|
for _, pemFile := range hl.TLS.RootCAPEMFiles {
|
||||||
pemData, err := ioutil.ReadFile(pemFile)
|
pemData, err := os.ReadFile(pemFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed reading ca cert: %v", err)
|
return nil, fmt.Errorf("failed reading ca cert: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -129,7 +129,7 @@ func (tc *Tester) initServer(rawConfig string, configType string) error {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
body, _ := ioutil.ReadAll(res.Body)
|
body, _ := io.ReadAll(res.Body)
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
_ = json.Indent(&out, body, "", " ")
|
_ = json.Indent(&out, body, "", " ")
|
||||||
|
@ -162,7 +162,7 @@ func (tc *Tester) initServer(rawConfig string, configType string) error {
|
||||||
timeElapsed(start, "caddytest: config load time")
|
timeElapsed(start, "caddytest: config load time")
|
||||||
|
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
body, err := ioutil.ReadAll(res.Body)
|
body, err := io.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tc.t.Errorf("unable to read response. %s", err)
|
tc.t.Errorf("unable to read response. %s", err)
|
||||||
return err
|
return err
|
||||||
|
@ -202,7 +202,7 @@ func (tc *Tester) ensureConfigRunning(rawConfig string, configType string) error
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
actualBytes, err := ioutil.ReadAll(resp.Body)
|
actualBytes, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,7 @@ func (tc *Tester) AssertResponse(req *http.Request, expectedStatusCode int, expe
|
||||||
resp := tc.AssertResponseCode(req, expectedStatusCode)
|
resp := tc.AssertResponseCode(req, expectedStatusCode)
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
bytes, err := ioutil.ReadAll(resp.Body)
|
bytes, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tc.t.Fatalf("unable to read the response body %s", err)
|
tc.t.Fatalf("unable to read the response body %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package integration
|
||||||
import (
|
import (
|
||||||
jsonMod "encoding/json"
|
jsonMod "encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
func TestCaddyfileAdaptToJSON(t *testing.T) {
|
func TestCaddyfileAdaptToJSON(t *testing.T) {
|
||||||
// load the list of test files from the dir
|
// load the list of test files from the dir
|
||||||
files, err := ioutil.ReadDir("./caddyfile_adapt")
|
files, err := os.ReadDir("./caddyfile_adapt")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to read caddyfile_adapt dir: %s", err)
|
t.Errorf("failed to read caddyfile_adapt dir: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func TestCaddyfileAdaptToJSON(t *testing.T) {
|
||||||
|
|
||||||
// read the test file
|
// read the test file
|
||||||
filename := f.Name()
|
filename := f.Name()
|
||||||
data, err := ioutil.ReadFile("./caddyfile_adapt/" + filename)
|
data, err := os.ReadFile("./caddyfile_adapt/" + filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to read %s dir: %s", filename, err)
|
t.Errorf("failed to read %s dir: %s", filename, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -85,7 +84,7 @@ func TestDialWithPlaceholderUnix(t *testing.T) {
|
||||||
t.SkipNow()
|
t.SkipNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := ioutil.TempFile("", "*.sock")
|
f, err := os.CreateTemp("", "*.sock")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to create TempFile: %s", err)
|
t.Errorf("failed to create TempFile: %s", err)
|
||||||
return
|
return
|
||||||
|
@ -387,7 +386,7 @@ func TestReverseProxyHealthCheckUnixSocket(t *testing.T) {
|
||||||
t.SkipNow()
|
t.SkipNow()
|
||||||
}
|
}
|
||||||
tester := caddytest.NewTester(t)
|
tester := caddytest.NewTester(t)
|
||||||
f, err := ioutil.TempFile("", "*.sock")
|
f, err := os.CreateTemp("", "*.sock")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to create TempFile: %s", err)
|
t.Errorf("failed to create TempFile: %s", err)
|
||||||
return
|
return
|
||||||
|
@ -442,7 +441,7 @@ func TestReverseProxyHealthCheckUnixSocketWithoutPort(t *testing.T) {
|
||||||
t.SkipNow()
|
t.SkipNow()
|
||||||
}
|
}
|
||||||
tester := caddytest.NewTester(t)
|
tester := caddytest.NewTester(t)
|
||||||
f, err := ioutil.TempFile("", "*.sock")
|
f, err := os.CreateTemp("", "*.sock")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to create TempFile: %s", err)
|
t.Errorf("failed to create TempFile: %s", err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -110,7 +109,7 @@ func TestH2ToH2CStream(t *testing.T) {
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
req := &http.Request{
|
req := &http.Request{
|
||||||
Method: "PUT",
|
Method: "PUT",
|
||||||
Body: ioutil.NopCloser(r),
|
Body: io.NopCloser(r),
|
||||||
URL: &url.URL{
|
URL: &url.URL{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: "127.0.0.1:9443",
|
Host: "127.0.0.1:9443",
|
||||||
|
@ -134,7 +133,7 @@ func TestH2ToH2CStream(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
bytes, err := ioutil.ReadAll(resp.Body)
|
bytes, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to read the response body %s", err)
|
t.Fatalf("unable to read the response body %s", err)
|
||||||
}
|
}
|
||||||
|
@ -319,7 +318,7 @@ func TestH2ToH1ChunkedResponse(t *testing.T) {
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
req := &http.Request{
|
req := &http.Request{
|
||||||
Method: "PUT",
|
Method: "PUT",
|
||||||
Body: ioutil.NopCloser(r),
|
Body: io.NopCloser(r),
|
||||||
URL: &url.URL{
|
URL: &url.URL{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: "127.0.0.1:9443",
|
Host: "127.0.0.1:9443",
|
||||||
|
@ -342,7 +341,7 @@ func TestH2ToH1ChunkedResponse(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
bytes, err := ioutil.ReadAll(resp.Body)
|
bytes, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to read the response body %s", err)
|
t.Fatalf("unable to read the response body %s", err)
|
||||||
}
|
}
|
||||||
|
@ -370,7 +369,7 @@ func testH2ToH1ChunkedResponseServeH1(t *testing.T) *http.Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
bytes, err := ioutil.ReadAll(r.Body)
|
bytes, err := io.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to read the response body %s", err)
|
t.Fatalf("unable to read the response body %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -181,7 +180,7 @@ func cmdRun(fl Flags) (int, error) {
|
||||||
var config []byte
|
var config []byte
|
||||||
var err error
|
var err error
|
||||||
if runCmdResumeFlag {
|
if runCmdResumeFlag {
|
||||||
config, err = ioutil.ReadFile(caddy.ConfigAutosavePath)
|
config, err = os.ReadFile(caddy.ConfigAutosavePath)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
// not a bad error; just can't resume if autosave file doesn't exist
|
// not a bad error; just can't resume if autosave file doesn't exist
|
||||||
caddy.Log().Info("no autosave file exists", zap.String("autosave_file", caddy.ConfigAutosavePath))
|
caddy.Log().Info("no autosave file exists", zap.String("autosave_file", caddy.ConfigAutosavePath))
|
||||||
|
@ -219,7 +218,7 @@ func cmdRun(fl Flags) (int, error) {
|
||||||
// if we are to report to another process the successful start
|
// if we are to report to another process the successful start
|
||||||
// of the server, do so now by echoing back contents of stdin
|
// of the server, do so now by echoing back contents of stdin
|
||||||
if runCmdPingbackFlag != "" {
|
if runCmdPingbackFlag != "" {
|
||||||
confirmationBytes, err := ioutil.ReadAll(os.Stdin)
|
confirmationBytes, err := io.ReadAll(os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return caddy.ExitCodeFailedStartup,
|
return caddy.ExitCodeFailedStartup,
|
||||||
fmt.Errorf("reading confirmation bytes from stdin: %v", err)
|
fmt.Errorf("reading confirmation bytes from stdin: %v", err)
|
||||||
|
@ -457,7 +456,7 @@ func cmdAdaptConfig(fl Flags) (int, error) {
|
||||||
fmt.Errorf("unrecognized config adapter: %s", adaptCmdAdapterFlag)
|
fmt.Errorf("unrecognized config adapter: %s", adaptCmdAdapterFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
input, err := ioutil.ReadFile(adaptCmdInputFlag)
|
input, err := os.ReadFile(adaptCmdInputFlag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return caddy.ExitCodeFailedStartup,
|
return caddy.ExitCodeFailedStartup,
|
||||||
fmt.Errorf("reading input file: %v", err)
|
fmt.Errorf("reading input file: %v", err)
|
||||||
|
@ -541,7 +540,7 @@ func cmdFmt(fl Flags) (int, error) {
|
||||||
|
|
||||||
// as a special case, read from stdin if the file name is "-"
|
// as a special case, read from stdin if the file name is "-"
|
||||||
if formatCmdConfigFile == "-" {
|
if formatCmdConfigFile == "-" {
|
||||||
input, err := ioutil.ReadAll(os.Stdin)
|
input, err := io.ReadAll(os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return caddy.ExitCodeFailedStartup,
|
return caddy.ExitCodeFailedStartup,
|
||||||
fmt.Errorf("reading stdin: %v", err)
|
fmt.Errorf("reading stdin: %v", err)
|
||||||
|
@ -550,7 +549,7 @@ func cmdFmt(fl Flags) (int, error) {
|
||||||
return caddy.ExitCodeSuccess, nil
|
return caddy.ExitCodeSuccess, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
input, err := ioutil.ReadFile(formatCmdConfigFile)
|
input, err := os.ReadFile(formatCmdConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return caddy.ExitCodeFailedStartup,
|
return caddy.ExitCodeFailedStartup,
|
||||||
fmt.Errorf("reading input file: %v", err)
|
fmt.Errorf("reading input file: %v", err)
|
||||||
|
@ -559,7 +558,7 @@ func cmdFmt(fl Flags) (int, error) {
|
||||||
output := caddyfile.Format(input)
|
output := caddyfile.Format(input)
|
||||||
|
|
||||||
if fl.Bool("overwrite") {
|
if fl.Bool("overwrite") {
|
||||||
if err := ioutil.WriteFile(formatCmdConfigFile, output, 0600); err != nil {
|
if err := os.WriteFile(formatCmdConfigFile, output, 0600); err != nil {
|
||||||
return caddy.ExitCodeFailedStartup, nil
|
return caddy.ExitCodeFailedStartup, nil
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -699,7 +698,7 @@ func apiRequest(adminAddr, method, uri string, headers http.Header, body io.Read
|
||||||
|
|
||||||
// if it didn't work, let the user know
|
// if it didn't work, let the user know
|
||||||
if resp.StatusCode >= 400 {
|
if resp.StatusCode >= 400 {
|
||||||
respBody, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1024*10))
|
respBody, err := io.ReadAll(io.LimitReader(resp.Body, 1024*10))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("HTTP %d: reading error message: %v", resp.StatusCode, err)
|
return fmt.Errorf("HTTP %d: reading error message: %v", resp.StatusCode, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
@ -94,7 +93,7 @@ func Main() {
|
||||||
// the bytes in expect, or returns an error if it doesn't.
|
// the bytes in expect, or returns an error if it doesn't.
|
||||||
func handlePingbackConn(conn net.Conn, expect []byte) error {
|
func handlePingbackConn(conn net.Conn, expect []byte) error {
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
confirmationBytes, err := ioutil.ReadAll(io.LimitReader(conn, 32))
|
confirmationBytes, err := io.ReadAll(io.LimitReader(conn, 32))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -124,9 +123,9 @@ func loadConfig(configFile, adapterName string) ([]byte, string, error) {
|
||||||
var err error
|
var err error
|
||||||
if configFile != "" {
|
if configFile != "" {
|
||||||
if configFile == "-" {
|
if configFile == "-" {
|
||||||
config, err = ioutil.ReadAll(os.Stdin)
|
config, err = io.ReadAll(os.Stdin)
|
||||||
} else {
|
} else {
|
||||||
config, err = ioutil.ReadFile(configFile)
|
config, err = os.ReadFile(configFile)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", fmt.Errorf("reading config file: %v", err)
|
return nil, "", fmt.Errorf("reading config file: %v", err)
|
||||||
|
@ -140,7 +139,7 @@ func loadConfig(configFile, adapterName string) ([]byte, string, error) {
|
||||||
// plugged in, and if so, try using a default Caddyfile
|
// plugged in, and if so, try using a default Caddyfile
|
||||||
cfgAdapter = caddyconfig.GetAdapter("caddyfile")
|
cfgAdapter = caddyconfig.GetAdapter("caddyfile")
|
||||||
if cfgAdapter != nil {
|
if cfgAdapter != nil {
|
||||||
config, err = ioutil.ReadFile("Caddyfile")
|
config, err = os.ReadFile("Caddyfile")
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
// okay, no default Caddyfile; pretend like this never happened
|
// okay, no default Caddyfile; pretend like this never happened
|
||||||
cfgAdapter = nil
|
cfgAdapter = nil
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -630,9 +629,9 @@ func (StderrWriter) OpenWriter() (io.WriteCloser, error) {
|
||||||
return notClosable{os.Stderr}, nil
|
return notClosable{os.Stderr}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenWriter returns ioutil.Discard that can't be closed.
|
// OpenWriter returns io.Discard that can't be closed.
|
||||||
func (DiscardWriter) OpenWriter() (io.WriteCloser, error) {
|
func (DiscardWriter) OpenWriter() (io.WriteCloser, error) {
|
||||||
return notClosable{ioutil.Discard}, nil
|
return notClosable{io.Discard}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// notClosable is an io.WriteCloser that can't be closed.
|
// notClosable is an io.WriteCloser that can't be closed.
|
||||||
|
|
|
@ -28,7 +28,6 @@ import (
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
|
@ -162,7 +161,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
|
||||||
return "", true
|
return "", true
|
||||||
}
|
}
|
||||||
// replace real body with buffered data
|
// replace real body with buffered data
|
||||||
req.Body = ioutil.NopCloser(buf)
|
req.Body = io.NopCloser(buf)
|
||||||
return buf.String(), true
|
return buf.String(), true
|
||||||
|
|
||||||
// original request, before any internal changes
|
// original request, before any internal changes
|
||||||
|
|
|
@ -30,7 +30,6 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -445,7 +444,7 @@ func (c *FCGIClient) Request(p map[string]string, req io.Reader) (resp *http.Res
|
||||||
if chunked(resp.TransferEncoding) {
|
if chunked(resp.TransferEncoding) {
|
||||||
resp.Body = clientCloser{c, httputil.NewChunkedReader(rb)}
|
resp.Body = clientCloser{c, httputil.NewChunkedReader(rb)}
|
||||||
} else {
|
} else {
|
||||||
resp.Body = clientCloser{c, ioutil.NopCloser(rb)}
|
resp.Body = clientCloser{c, io.NopCloser(rb)}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
|
@ -166,7 +165,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
content, _ = ioutil.ReadAll(resp.Body)
|
content, _ = io.ReadAll(resp.Body)
|
||||||
|
|
||||||
log.Println("c: send data length ≈", length, string(content))
|
log.Println("c: send data length ≈", length, string(content))
|
||||||
fcgi.Close()
|
fcgi.Close()
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -282,7 +281,7 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, host H
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
// drain any remaining body so connection could be re-used
|
// drain any remaining body so connection could be re-used
|
||||||
_, _ = io.Copy(ioutil.Discard, body)
|
_, _ = io.Copy(io.Discard, body)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -313,7 +312,7 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, host H
|
||||||
|
|
||||||
// if body does not match regex, mark down
|
// if body does not match regex, mark down
|
||||||
if h.HealthChecks.Active.bodyRegexp != nil {
|
if h.HealthChecks.Active.bodyRegexp != nil {
|
||||||
bodyBytes, err := ioutil.ReadAll(body)
|
bodyBytes, err := io.ReadAll(body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.HealthChecks.Active.logger.Info("failed to read response body",
|
h.HealthChecks.Active.logger.Info("failed to read response body",
|
||||||
zap.String("host", hostAddr),
|
zap.String("host", hostAddr),
|
||||||
|
|
|
@ -20,10 +20,10 @@ import (
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
weakrand "math/rand"
|
weakrand "math/rand"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ func (t TLSConfig) MakeTLSClientConfig(ctx caddy.Context) (*tls.Config, error) {
|
||||||
rootPool.AddCert(caCert)
|
rootPool.AddCert(caCert)
|
||||||
}
|
}
|
||||||
for _, pemFile := range t.RootCAPEMFiles {
|
for _, pemFile := range t.RootCAPEMFiles {
|
||||||
pemData, err := ioutil.ReadFile(pemFile)
|
pemData, err := os.ReadFile(pemFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed reading ca cert: %v", err)
|
return nil, fmt.Errorf("failed reading ca cert: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ package caddyhttp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -44,7 +44,7 @@ func TestStaticResponseHandler(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := w.Result()
|
resp := w.Result()
|
||||||
respBody, _ := ioutil.ReadAll(resp.Body)
|
respBody, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusNotFound {
|
if resp.StatusCode != http.StatusNotFound {
|
||||||
t.Errorf("expected status %d but got %d", http.StatusNotFound, resp.StatusCode)
|
t.Errorf("expected status %d but got %d", http.StatusNotFound, resp.StatusCode)
|
||||||
|
|
|
@ -17,7 +17,6 @@ package templates
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -118,7 +117,7 @@ func TestImport(t *testing.T) {
|
||||||
// create files for test case
|
// create files for test case
|
||||||
if test.fileName != "" {
|
if test.fileName != "" {
|
||||||
absFilePath := filepath.Join(fmt.Sprintf("%s", context.Root), test.fileName)
|
absFilePath := filepath.Join(fmt.Sprintf("%s", context.Root), test.fileName)
|
||||||
if err := ioutil.WriteFile(absFilePath, []byte(test.fileContent), os.ModePerm); err != nil {
|
if err := os.WriteFile(absFilePath, []byte(test.fileContent), os.ModePerm); err != nil {
|
||||||
os.Remove(absFilePath)
|
os.Remove(absFilePath)
|
||||||
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
|
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -198,7 +197,7 @@ func TestInclude(t *testing.T) {
|
||||||
// create files for test case
|
// create files for test case
|
||||||
if test.fileName != "" {
|
if test.fileName != "" {
|
||||||
absFilePath := filepath.Join(fmt.Sprintf("%s", context.Root), test.fileName)
|
absFilePath := filepath.Join(fmt.Sprintf("%s", context.Root), test.fileName)
|
||||||
if err := ioutil.WriteFile(absFilePath, []byte(test.fileContent), os.ModePerm); err != nil {
|
if err := os.WriteFile(absFilePath, []byte(test.fileContent), os.ModePerm); err != nil {
|
||||||
os.Remove(absFilePath)
|
os.Remove(absFilePath)
|
||||||
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
|
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -357,13 +356,13 @@ func TestFileListing(t *testing.T) {
|
||||||
|
|
||||||
// create files for test case
|
// create files for test case
|
||||||
if test.fileNames != nil {
|
if test.fileNames != nil {
|
||||||
dirPath, err = ioutil.TempDir(fmt.Sprintf("%s", context.Root), "caddy_ctxtest")
|
dirPath, err = os.MkdirTemp(fmt.Sprintf("%s", context.Root), "caddy_ctxtest")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Test %d: Expected no error creating directory, got: '%s'", i, err.Error())
|
t.Fatalf("Test %d: Expected no error creating directory, got: '%s'", i, err.Error())
|
||||||
}
|
}
|
||||||
for _, name := range test.fileNames {
|
for _, name := range test.fileNames {
|
||||||
absFilePath := filepath.Join(dirPath, name)
|
absFilePath := filepath.Join(dirPath, name)
|
||||||
if err = ioutil.WriteFile(absFilePath, []byte(""), os.ModePerm); err != nil {
|
if err = os.WriteFile(absFilePath, []byte(""), os.ModePerm); err != nil {
|
||||||
os.RemoveAll(dirPath)
|
os.RemoveAll(dirPath)
|
||||||
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
|
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -137,11 +137,11 @@ type KeyPair struct {
|
||||||
func (kp KeyPair) Load() (*x509.Certificate, interface{}, error) {
|
func (kp KeyPair) Load() (*x509.Certificate, interface{}, error) {
|
||||||
switch kp.Format {
|
switch kp.Format {
|
||||||
case "", "pem_file":
|
case "", "pem_file":
|
||||||
certData, err := ioutil.ReadFile(kp.Certificate)
|
certData, err := os.ReadFile(kp.Certificate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
keyData, err := ioutil.ReadFile(kp.PrivateKey)
|
keyData, err := os.ReadFile(kp.PrivateKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ func (iss *ACMEIssuer) Provision(ctx caddy.Context) error {
|
||||||
if len(iss.TrustedRootsPEMFiles) > 0 {
|
if len(iss.TrustedRootsPEMFiles) > 0 {
|
||||||
iss.rootPool = x509.NewCertPool()
|
iss.rootPool = x509.NewCertPool()
|
||||||
for _, pemFile := range iss.TrustedRootsPEMFiles {
|
for _, pemFile := range iss.TrustedRootsPEMFiles {
|
||||||
pemData, err := ioutil.ReadFile(pemFile)
|
pemData, err := os.ReadFile(pemFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("loading trusted root CA's PEM file: %s: %v", pemFile, err)
|
return fmt.Errorf("loading trusted root CA's PEM file: %s: %v", pemFile, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/caddyserver/caddy/v2"
|
"github.com/caddyserver/caddy/v2"
|
||||||
|
@ -369,7 +369,7 @@ func (clientauth *ClientAuthentication) ConfigureTLSConfig(cfg *tls.Config) erro
|
||||||
caPool.AddCert(clientCA)
|
caPool.AddCert(clientCA)
|
||||||
}
|
}
|
||||||
for _, pemFile := range clientauth.TrustedCACertPEMFiles {
|
for _, pemFile := range clientauth.TrustedCACertPEMFiles {
|
||||||
pemContents, err := ioutil.ReadFile(pemFile)
|
pemContents, err := os.ReadFile(pemFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("reading %s: %v", pemFile, err)
|
return fmt.Errorf("reading %s: %v", pemFile, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ package caddytls
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"os"
|
||||||
|
|
||||||
"github.com/caddyserver/caddy/v2"
|
"github.com/caddyserver/caddy/v2"
|
||||||
)
|
)
|
||||||
|
@ -59,11 +59,11 @@ type CertKeyFilePair struct {
|
||||||
func (fl FileLoader) LoadCertificates() ([]Certificate, error) {
|
func (fl FileLoader) LoadCertificates() ([]Certificate, error) {
|
||||||
certs := make([]Certificate, 0, len(fl))
|
certs := make([]Certificate, 0, len(fl))
|
||||||
for _, pair := range fl {
|
for _, pair := range fl {
|
||||||
certData, err := ioutil.ReadFile(pair.Certificate)
|
certData, err := os.ReadFile(pair.Certificate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
keyData, err := ioutil.ReadFile(pair.Key)
|
keyData, err := os.ReadFile(pair.Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -79,7 +78,7 @@ func (fl FolderLoader) LoadCertificates() ([]Certificate, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func x509CertFromCertAndKeyPEMFile(fpath string) (tls.Certificate, error) {
|
func x509CertFromCertAndKeyPEMFile(fpath string) (tls.Certificate, error) {
|
||||||
bundle, err := ioutil.ReadFile(fpath)
|
bundle, err := os.ReadFile(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return tls.Certificate{}, err
|
return tls.Certificate{}, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue