feat: use persistent configuration file
This commit is contained in:
@ -19,15 +19,24 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func NewLANCert() (*tls.Certificate, error) {
|
||||
func NewLANKeyPair() ([]byte, []byte, error) {
|
||||
hosts, err := network.GetLANIPv4Addrs()
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
return nil, nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
hosts = append(hosts, "127.0.0.1")
|
||||
|
||||
rawCert, rawKey, err := NewCertKeyPair(hosts...)
|
||||
if err != nil {
|
||||
return nil, nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
return rawCert, rawKey, nil
|
||||
}
|
||||
|
||||
func NewLANCert() (*tls.Certificate, error) {
|
||||
rawCert, rawKey, err := NewLANKeyPair()
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user