Categorygithub.com/plgd-dev/client-application

# README

CI Quality Gate Status codecov

Client Application

Provides GRPC and HTTP APIs to interact with the OCF devices via D2D communication.

Run

The client application can be run by executing the following command:

./client-application
  • Default config.yaml file will be generated in case it's not in the same directory as the client application, or if a different path with the existing config isn't specified.
  • Default web UI files will be copied to the www folder next to the client application in case it doesn't exist, or if a different path with existing UI files isn't specified in the config file.

Supported options

  • --config: path to the config file
  • --version: print the version of the client application

Build

The build process uses goreleaser, so you will need to commit all changes and create a tag on the local machine.

git commit -a -m "my changes"
git tag -f v0.0.1-myversion
make build

Docker

You can run the client application in a docker container by executing the following command.

docker run --rm -it -e NUM_DEVICES=1 -p 8080:8080 ghcr.io/plgd-dev/client-application:latest

Via environment variable NUM_DEVICES you can specify the number of devices simulators. The default value is 1. The client application will be available at http://locahost:8080.

YAML Configuration

A configuration template is available on config.yaml.

Logging

PropertyTypeDescriptionDefault
log.dumpBodyboolSet to true if you would like to dump raw messages.false
log.levelstringLogging enabled from level."info"
log.encodingstringLogging format. The supported values are: "json", "console""console"
log.stacktrace.enabledboolLog stacktrace."false
log.stacktrace.levelstringStacktrace from level."warn
log.encoderConfig.timeEncoderstringTime format for logs. The supported values are: "rfc3339nano", "rfc3339"."rfc3339nano

HTTP API

HTTP API of the client application service as defined swagger.

PropertyTypeDescriptionDefault
apis.http.enabledboolEnable the HTTP API.true
apis.http.cors.allowedOrigins[]stringSets the allowed origins for CORS requests, as used in the 'Allow-Access-Control-Origin' HTTP header. Passing in a "*" will allow any domain."*"
apis.http.cors.allowedHeaders[]stringAdds the provided headers to the list of allowed headers in a CORS request. This is an append operation so the headers Accept, Accept-Language, and Content-Language are always allowed. Content-Type must be explicitly declared if accepting Content-Types other than application/x-www-form-urlencoded, multipart/form-data, or text/plain."Accept","Accept-Language","Accept-Encoding","Content-Type","Content-Language","Content-Length","Origin","X-CSRF-Token","Authorization"
apis.http.cors.allowedMethods[]stringExplicitly set allowed methods in the Access-Control-Allow-Methods header. This is a replacement operation so you must also pass GET, HEAD, and POST if you wish to support those methods."GET","PATCH","HEAD","POST","PUT","OPTIONS","DELETE"
apis.http.cors.allowCredentialsboolUser agent may pass authentication details along with the request.false
apis.http.addressstringListen specification <host>:<port> for http client connection."0.0.0.0:8080"
apis.http.readTimeoutstringThe maximum duration for reading the entire request, including the body by the server. A zero or negative value means there will be no timeout.8s
apis.http.readHeaderTimeoutstringThe amount of time allowed to read request headers by the server. If readHeaderTimeout is zero, the value of readTimeout is used. If both are zero, there is no timeout.4s
apis.http.writeTimeoutstringThe maximum duration before the server times out writing of the response. A zero or negative value means there will be no timeout.16s
apis.http.idleTimeoutstringThe maximum amount of time the server waits for the next request when keep-alives are enabled. If idleTimeout is zero, the value of readTimeout is used. If both are zero, there is no timeout.30s
apis.http.ui.enabledboolSet to true if you would like to run the web UI.false
apis.http.ui.directorystringA path to the directory with web UI files. When it is not present, it creates <client_application_binary>/www with default ui.""
apis.http.tls.enabledboolEnable HTTPS.false
apis.http.tls.caPool[]stringFile path to the root certificate in PEM format which might contain multiple certificates in a single file.""
apis.http.tls.keyFilestringFile path to private key in PEM format.""
apis.http.tls.certFilestringFile path to certificate in PEM format.""
apis.http.tls.clientCertificateRequiredboolIf true, require client certificate.true

gRPC API

gRPC API of the client application service as defined service.

PropertyTypeDescriptionDefault
apis.grpc.enabledboolEnable the GRPC API.true
apis.grpc.addressstringListen specification <host>:<port> for grpc client connection."0.0.0.0:8081"
apis.grpc.enforcementPolicy.minTimestringThe minimum amount of time a client should wait before sending a keepalive ping. Otherwise the server close connection.5s
apis.grpc.enforcementPolicy.permitWithoutStreamboolIf true, server allows keepalive pings even when there are no active streams(RPCs). Otherwise the server close connection.false
apis.grpc.keepAlive.maxConnectionIdlestringA duration for the amount of time after which an idle connection would be closed by sending a GoAway. 0s means infinity.0s
apis.grpc.keepAlive.maxConnectionAgestringA duration for the maximum amount of time a connection may exist before it will be closed by sending a GoAway. 0s means infinity.0s
apis.grpc.keepAlive.maxConnectionAgeGracestringAn additive period after MaxConnectionAge after which the connection will be forcibly closed. 0s means infinity.0s
apis.grpc.keepAlive.timestringAfter a duration of this time if the server doesn't see any activity it pings the client to see if the transport is still alive.2h
apis.grpc.keepAlive.timeoutstringAfter having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed.20s
apis.grpc.tls.caPool[]stringFile path to the root certificate in PEM format which might contain multiple certificates in a single file.""
apis.grpc.tls.enabledboolEnable TLS for grpc.false
apis.grpc.tls.keyFilestringFile path to private key in PEM format.""
apis.grpc.tls.certFilestringFile path to certificate in PEM format.""
apis.grpc.tls.clientCertificateRequiredboolIf true, require client certificate.true

Device client

The configuration sets up access to the devices via COAP protocol.

PropertyTypeDescriptionDefault
apis.coap.maxMessageSizeintMax message size which can be sent/received via coap. i.e. 256*1024 = 262144 bytes.262144
apis.coap.inactivityMonitor.timeoutstringTime limit to close inactive connection.20s
apis.coap.blockwiseTransfer.enabledboolIf true, enable blockwise transfer of coap messages.false
apis.coap.blockwiseTransfer.blockSizeintSize of blockwise transfer block.1024
apis.coap.ownershipTransfer.methods[]stringAllowed ownership transfer methods. The supported values are: "justWorks", "manufacturerCertificate"."justWorks"
apis.coap.ownershipTransfer.manufacturerCertificate.tls.caPool[]stringFile paths to the root certificates in PEM format. The file may contain multiple certificates.""
apis.coap.ownershipTransfer.manufacturerCertificate.tls.keyFilestringFile path to certificate client application private key in PEM format.""
apis.coap.ownershipTransfer.manufacturerCertificate.tls.certFilestringFile path to certificate client application certificate in PEM format.""
apis.coap.tls.preSharedKey.subjectIdstringProvides an identifier for client applications for establishing TLS connections or for devices that are set as owner devices""
apis.coap.tls.preSharedKey.keystringPre-shared key used in conjunction with subjectId to enable TLS connection.""

Remote provisioning

The configuration sets up ownership and authorization of devices via the remote provisioning mode.

Supported modes:

PropertyTypeDescriptionDefault
remoteProvisioning.modestringProvides remote provisioning mode. In "userAgent" mode all signing certificates goes through the user agent (browser,cli). "" means none. The supported values are: "", "userAgent"""
remoteProvisioning.certificateAuthoritystringCertificate authority server address in format {SCHEME}://{DNS}:{PORT}""
remoteProvisioning.userAgent.csrChallengeStateExpirationstringDefines how long is valid csr challenge."1m"
remoteProvisioning.authoritystringAuthority is the address of the token-issuing authentication server.""
remoteProvisioning.webOAuthClient.clientIDstringClient ID to exchange an authorization code for an access token.""
remoteProvisioning.webOAuthClient.audiencestringIdentifier of the API configured in your OAuth provider.""
remoteProvisioning.webOAuthClient.scopes[]stringList of required scopes.[]
remoteProvisioning.ownerClaimstringClaim used to identify owner of the device."sub"
remoteProvisioning.hubIDstringPlgd hub id.""
remoteProvisioning.coapGatewaystringCoAP gateway for onboard device.""
remoteProvisioning.caPool[]stringFile paths to root CAs which was used to sign coap-gw certificate.""
remoteProvisioning.deviceOAuthClient.clientIDstringClient ID to exchange an authorization code for an access token.""
remoteProvisioning.deviceOAuthClient.audiencestringIdentifier of the API configured in your OAuth provider.""
remoteProvisioning.deviceOAuthClient.scopes[]stringList of required scopes.[]
remoteProvisioning.deviceOAuthClient.providerNamestringName of provider, which needs to be set to cloud resource during cloud provisioning.""

Note that the string type related to time (i.e. timeout, idleConnTimeout, expirationTime) is decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid time units are "ns", "us", "ms", "s", "m", "h".

# Packages

No description provided by the author
Package pb is a reverse proxy.
No description provided by the author
No description provided by the author
No description provided by the author