You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
978 B

  1. package abciclient
  2. import (
  3. "fmt"
  4. "github.com/tendermint/tendermint/abci/types"
  5. "github.com/tendermint/tendermint/libs/log"
  6. )
  7. // Creator creates new ABCI clients.
  8. type Creator func(log.Logger) (Client, error)
  9. // NewLocalCreator returns a Creator for the given app,
  10. // which will be running locally.
  11. func NewLocalCreator(app types.Application) Creator {
  12. return func(logger log.Logger) (Client, error) {
  13. return NewLocalClient(logger, app), nil
  14. }
  15. }
  16. // NewRemoteCreator returns a Creator for the given address (e.g.
  17. // "192.168.0.1") and transport (e.g. "tcp"). Set mustConnect to true if you
  18. // want the client to connect before reporting success.
  19. func NewRemoteCreator(logger log.Logger, addr, transport string, mustConnect bool) Creator {
  20. return func(log.Logger) (Client, error) {
  21. remoteApp, err := NewClient(logger, addr, transport, mustConnect)
  22. if err != nil {
  23. return nil, fmt.Errorf("failed to connect to proxy: %w", err)
  24. }
  25. return remoteApp, nil
  26. }
  27. }