Skip to content
Snippets Groups Projects
Commit 912d089a authored by Jonah Husson's avatar Jonah Husson
Browse files

Use atomic cert for remote, rename to getremotecertificate

parent 62f4ec17
No related branches found
No related tags found
2 merge requests!59Use atomic cert for remote, rename to getremotecertificate,!39Merge release into master
...@@ -53,7 +53,7 @@ type Connection interface { ...@@ -53,7 +53,7 @@ type Connection interface {
IsOnline() (time.Duration, bool) IsOnline() (time.Duration, bool)
GetServerCert() (*x509.Certificate, error) GetRemoteCertificate() (*x509.Certificate, error)
clientConnHelpers clientConnHelpers
} }
......
...@@ -214,7 +214,7 @@ func TestWebConnection_TLS(t *testing.T) { ...@@ -214,7 +214,7 @@ func TestWebConnection_TLS(t *testing.T) {
t.Errorf("Did not receive expected payload") t.Errorf("Did not receive expected payload")
} }
_, err = h.GetServerCert() _, err = h.GetRemoteCertificate()
if err != nil { if err != nil {
t.Errorf("Did not receive cert: %+v", err) t.Errorf("Did not receive cert: %+v", err)
} }
......
...@@ -41,8 +41,8 @@ func (gc *grpcConn) IsWeb() bool { ...@@ -41,8 +41,8 @@ func (gc *grpcConn) IsWeb() bool {
return false return false
} }
// GetServerCert returns an error on grpc hosts // GetRemoteCertificate returns an error on grpc hosts
func (gc *grpcConn) GetServerCert() (*x509.Certificate, error) { func (gc *grpcConn) GetRemoteCertificate() (*x509.Certificate, error) {
return nil, errors.New("GetServerCert not implemented for GRPC hosts") return nil, errors.New("GetServerCert not implemented for GRPC hosts")
} }
......
...@@ -216,11 +216,11 @@ func (h *Host) IsWeb() bool { ...@@ -216,11 +216,11 @@ func (h *Host) IsWeb() bool {
return h.connection.IsWeb() return h.connection.IsWeb()
} }
// GetServerCert returns the tls certificate from the server for web hosts // GetRemoteCertificate returns the tls certificate from the server for web hosts
// Note that this will return an error when used on grpc hosts, and will not // Note that this will return an error when used on grpc hosts, and will not
// have a certificate ready until something has been sent over the connection. // have a certificate ready until something has been sent over the connection.
func (h *Host) GetServerCert() (*x509.Certificate, error) { func (h *Host) GetRemoteCertificate() (*x509.Certificate, error) {
return h.connection.GetServerCert() return h.connection.GetRemoteCertificate()
} }
// SetMetricsTesting sets the host metrics to an arbitrary value. Used for testing // SetMetricsTesting sets the host metrics to an arbitrary value. Used for testing
......
...@@ -67,9 +67,9 @@ func (wc *webConn) IsWeb() bool { ...@@ -67,9 +67,9 @@ func (wc *webConn) IsWeb() bool {
return true return true
} }
// GetServerCert returns the server tls certificate stored by the web connection // GetRemoteCertificate returns the server tls certificate stored by the web connection
func (wc *webConn) GetServerCert() (*x509.Certificate, error) { func (wc *webConn) GetRemoteCertificate() (*x509.Certificate, error) {
return wc.connection.GetReceivedCertificate() return wc.connection.GetRemoteCertificate()
} }
// connectWebHelper initializes the grpcweb ClientConn object // connectWebHelper initializes the grpcweb ClientConn object
......
...@@ -3,7 +3,7 @@ module gitlab.com/xx_network/comms ...@@ -3,7 +3,7 @@ module gitlab.com/xx_network/comms
go 1.19 go 1.19
require ( require (
git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220161254-68bee4d4a516 git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221221203224-436c7ab720af
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/improbable-eng/grpc-web v0.15.0 github.com/improbable-eng/grpc-web v0.15.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
......
...@@ -5,6 +5,10 @@ git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220131901-1a7cdcec1831 h1: ...@@ -5,6 +5,10 @@ git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220131901-1a7cdcec1831 h1:
git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220131901-1a7cdcec1831/go.mod h1:uFKw2wmgtlYMdiIm08dM0Vj4XvX9ZKVCj71c8O7SAPo= git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220131901-1a7cdcec1831/go.mod h1:uFKw2wmgtlYMdiIm08dM0Vj4XvX9ZKVCj71c8O7SAPo=
git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220161254-68bee4d4a516 h1:Z1AimDI/+3ZZGcmkQaprDKiDn8oGmha7yyPvkDzIuMI= git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220161254-68bee4d4a516 h1:Z1AimDI/+3ZZGcmkQaprDKiDn8oGmha7yyPvkDzIuMI=
git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220161254-68bee4d4a516/go.mod h1:uFKw2wmgtlYMdiIm08dM0Vj4XvX9ZKVCj71c8O7SAPo= git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221220161254-68bee4d4a516/go.mod h1:uFKw2wmgtlYMdiIm08dM0Vj4XvX9ZKVCj71c8O7SAPo=
git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221221203031-c72e32187f30 h1:BpAfpIbpCNIkrUyLajIq+ymrsgKXoc3N930mdQ2OfLQ=
git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221221203031-c72e32187f30/go.mod h1:uFKw2wmgtlYMdiIm08dM0Vj4XvX9ZKVCj71c8O7SAPo=
git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221221203224-436c7ab720af h1:ogiu6sKbFjsKaMnmYSlflJDf973v4TVtBDSnUR2vEPQ=
git.xx.network/elixxir/grpc-web-go-client v0.0.0-20221221203224-436c7ab720af/go.mod h1:uFKw2wmgtlYMdiIm08dM0Vj4XvX9ZKVCj71c8O7SAPo=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment