fix repocard issues (#21)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-08-25 15:41:48 +03:00
committed by GitHub
parent 8076e410a9
commit 67ab44593b
13 changed files with 68 additions and 38 deletions

View File

@@ -122,12 +122,13 @@ func Listen(entries chan<- *ServiceEntry, exit chan struct{}) error {
ip := make(map[string]*ServiceEntry)
loop:
for {
select {
case <-exit:
return nil
break loop
case <-client.closedCh:
return nil
break loop
case m := <-msgCh:
e := messageToEntry(m, ip)
if e == nil {

View File

@@ -163,7 +163,9 @@ func (s *Server) Shutdown() error {
s.shutdown = true
close(s.shutdownCh)
s.unregister()
if err := s.unregister(); err != nil {
return err
}
if s.ipv4List != nil {
s.ipv4List.Close()

View File

@@ -147,6 +147,7 @@ func Sign(CACrt, CAKey, CSR []byte, opts ...CertOption) ([]byte, error) {
return out.Bytes(), nil
}
//nolint:gocritic
func decodePEM(PEM []byte) ([]*pem.Block, error) {
var blocks []*pem.Block
var asn1 *pem.Block

View File

@@ -60,7 +60,9 @@ func Certificate(host ...string) (tls.Certificate, error) {
// create public key
certOut := bytes.NewBuffer(nil)
pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes})
if err = pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil {
return tls.Certificate{}, err
}
// create private key
keyOut := bytes.NewBuffer(nil)
@@ -68,7 +70,9 @@ func Certificate(host ...string) (tls.Certificate, error) {
if err != nil {
return tls.Certificate{}, err
}
pem.Encode(keyOut, &pem.Block{Type: "EC PRIVATE KEY", Bytes: b})
if err = pem.Encode(keyOut, &pem.Block{Type: "EC PRIVATE KEY", Bytes: b}); err != nil {
return tls.Certificate{}, err
}
return tls.X509KeyPair(certOut.Bytes(), keyOut.Bytes())
}