feat: use persistent configuration file

This commit is contained in:
2024-04-24 10:49:47 +02:00
parent 071d597f3f
commit fa1ed6ea42
8 changed files with 307 additions and 69 deletions

View File

@ -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)
}