Welcome to the SCANOSS Platform 2.0 gRPC server helper package.
This package contains helper functions to make development of Go gRPC services easier to configure.
This repository is made up of the following components:
The files package provides the following helpers:
- Check if TLS should be enabled or not
- Load filter config files
startTLS, err = CheckTLS("server.crt", "server.key")
allowedIPs, deniedIPs, err = LoadFiltering("allow_list.txt", "deny_list.txt")
The server package provides the following helpers:
- Configure
- Start
- Stop
listen, server, err := SetupGrpcServer(":0", "server.crt", "server.key", allowedIPs, deniedIPs, true, true, false)
StartGrpcServer(listen, server, true)
err = WaitServerComplete(srv, server)
The gateway package provides the following helpers:
- Configure
- Start
allowedIPs := []string{"127.0.0.1"}
deniedIPs := []string{"192.168.0.1"}
srv, mux, gateway, opts, err := SetupGateway("9443", "8443", "server.crt", allowedIPs, deniedIPs, true, false, true)
StartGateway(srv, "server.crt", "server.key", true)
The database package provide the following helpers:
- Open DB connection
- Setup DB options
- Close DB connection
- Close SQL connection
db, err := OpenDBConnection(":memory:", "sqlite", "", "", "", "", "")
err = SetDBOptionsAndPing(db)
CloseDBConnection(db)
CloseSQLConnection(conn)
To request features or alert about bugs, please do so here.
Details of major changes to the library can be found in CHANGELOG.md.