Browse Source

En cours de développement

master
mls-361 9 months ago
parent
commit
5510e1fbb5
  1. 2
      go.mod
  2. 4
      go.sum
  3. 9
      internal/cli/requestor.go
  4. 1
      internal/config/data/server.go
  5. 4
      internal/server/server.go

2
go.mod

@ -6,7 +6,7 @@ require (
forge.chapril.org/armen/jw v0.0.0-20210805210545-da8788595df5
forge.chapril.org/armen/memory v0.0.0-20210805210634-d02aca0da758
forge.chapril.org/armen/model v0.0.0-20210805210659-1e2499fdebb8
forge.chapril.org/armen/requestor v0.0.0-20210808165107-af10da389584
forge.chapril.org/armen/requestor v0.0.0-20210810201335-509a2128c304
forge.chapril.org/armen/runner v0.0.0-20210805210803-07ab6d0373d9
forge.chapril.org/armen/workers v0.0.0-20210805210824-756d247bb747
forge.chapril.org/mls-361/application v0.0.0-20210805205753-c663b93b7e1a

4
go.sum

@ -6,8 +6,8 @@ forge.chapril.org/armen/memory v0.0.0-20210805210634-d02aca0da758 h1:cEHlMCL2N2h
forge.chapril.org/armen/memory v0.0.0-20210805210634-d02aca0da758/go.mod h1:Y8JRYs23Dt4kT00PHGUmObmc1+UoB0bGyzhbk9R+hJw=
forge.chapril.org/armen/model v0.0.0-20210805210659-1e2499fdebb8 h1:y7SxEdO7CYPPgEjNJMhOpEFDg6GLhVpJTClTY/bkKWc=
forge.chapril.org/armen/model v0.0.0-20210805210659-1e2499fdebb8/go.mod h1:LuUKO1d3ueQC9XD2lCIyvUGcbeHdu1erSoOF7c8MKHo=
forge.chapril.org/armen/requestor v0.0.0-20210808165107-af10da389584 h1:VYa8EpVWHSmTXp9IrgNqCtTH6sp/vCSbPczFKkzGZao=
forge.chapril.org/armen/requestor v0.0.0-20210808165107-af10da389584/go.mod h1:yZYVn9Uwfsdk3ieqkV7slLx9xh2bVZEwiboxK8FKdD8=
forge.chapril.org/armen/requestor v0.0.0-20210810201335-509a2128c304 h1:EU3BY7pqwf8FJbXoNELNWuyD522vFJKgo8B+WTKlarM=
forge.chapril.org/armen/requestor v0.0.0-20210810201335-509a2128c304/go.mod h1:yZYVn9Uwfsdk3ieqkV7slLx9xh2bVZEwiboxK8FKdD8=
forge.chapril.org/armen/runner v0.0.0-20210805210803-07ab6d0373d9 h1:r5GosY9G4iNRVcjfMGVLG0Upep8CvFIk47RbWdDjATY=
forge.chapril.org/armen/runner v0.0.0-20210805210803-07ab6d0373d9/go.mod h1:JOoUDfdPqo2TiEFpLhYKCgYtcLSbbLij/LuQArpBjLE=
forge.chapril.org/armen/workers v0.0.0-20210805210824-756d247bb747 h1:rjbteEWr7PSkYt7kRYITpzpndekH7R7f2Lk2AVudZyw=

9
internal/cli/requestor.go

@ -36,11 +36,20 @@ func newRequestor(ccs *components.Components) (jw.Model, error) {
Password: password,
}
if cfg.TLS != nil {
endpoint.CA = cfg.TLS.CA
}
rc := &requestor.Config{
Logger: ccs.Logger,
Endpoints: []*requestor.Endpoint{endpoint},
}
if cli := cfg.TLS.Cli; cli != nil {
rc.Cert = cli.Cert
rc.Key = cli.Key
}
return requestor.New(rc)
}

1
internal/config/data/server.go

@ -10,7 +10,6 @@ const _defaultServerPort = 65530
// Cli AFAIRE.
type Cli struct {
CA string
Cert string
Key string
}

4
internal/server/server.go

@ -11,9 +11,9 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"time"
"forge.chapril.org/mls-361/errors"
@ -50,7 +50,7 @@ func (cs *server) getTLSConfig(d *data.TLS) (*tls.Config, error) {
authType := tls.NoClientCert
if d.AuthType != 0 {
buf, err := ioutil.ReadFile(d.CA)
buf, err := os.ReadFile(d.CA)
if err != nil {
return nil, errors.WithMessage(err, "unable to read this file", "file", d.CA) //////////////////////////////
}

Loading…
Cancel
Save