tron

package module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 20 Imported by: 5

README

Tron

Installation
install tron:
curl -sSfL https://raw.githubusercontent.com/loghole/tron/main/install.sh | sh
tron version
install protoc:
  • linux
$ apt install -y protobuf-compiler
$ protoc --version
  • mac:
$ brew install protobuf
$ protoc --version

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetName

func SetName(name string)

SetName overrides default the application name.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(options ...app.Option) (*App, error)

New init viper config, logger and tracer.

func (*App) Close added in v0.2.0

func (a *App) Close()

Close closes tracer and logger.

func (*App) Info

func (a *App) Info() *Info

func (*App) Logger

func (a *App) Logger() *zap.Logger

func (*App) Router

func (a *App) Router() chi.Router

func (*App) Run

func (a *App) Run(impl ...transport.Service) error

Run apply run options if exists and starts servers.

func (*App) TraceLogger

func (a *App) TraceLogger() tracelog.Logger

func (*App) Tracer

func (a *App) Tracer() *tracing.Tracer

func (*App) WithRunOptions

func (a *App) WithRunOptions(opts ...app.RunOption) *App

Append some run options.

type Info

type Info = app.Info

type Option

type Option = app.Option

func AddLogCaller

func AddLogCaller() Option

AddLogCaller configures the Logger to annotate each message with the filename and line number of zap's caller. See also WithCaller.

func AddLogStacktrace

func AddLogStacktrace(level string) Option

AddLogStacktrace configures the Logger to record a stack trace for all messages at or above a given level.

func WithAdminHTTP

func WithAdminHTTP(port uint16) Option

func WithCORSAllowedAuthentication added in v0.2.1

func WithCORSAllowedAuthentication(allow bool) Option

WithCORSAllowedAuthentication sets if HTTP client allows authentication like cookies, SSL certs and HTTP basic auth.

func WithCORSAllowedHeaders added in v0.2.1

func WithCORSAllowedHeaders(headers []string) Option

WithCORSAllowedHeaders sets a list of non simple headers the HTTP client is allowed to use with cross-domain requests. If the special "*" value is present in the list, all headers will be allowed. Default value is [] but "Origin" is always appended to the list.

func WithCORSAllowedOrigins added in v0.2.1

func WithCORSAllowedOrigins(origins []string) Option

WithCORSAllowedOrigins sets allowed origin domains for cross-domain requests. If the special "*" value is present in the list, all origins will be allowed. An origin may contain a wildcard (*) to replace 0 or more characters (i.e.: http://*.domain.com). Usage of wildcards implies a small performance penality. Only one wildcard can be used per origin. Default option enable CORS for requests on admin port.

func WithExitSignals

func WithExitSignals(sig ...os.Signal) Option

func WithLogField

func WithLogField(key string, value interface{}) Option

WithLogField adds field to the Logger.

func WithPublicGRPc

func WithPublicGRPc(port uint16) Option

func WithPublicHTTP

func WithPublicHTTP(port uint16) Option

type RunOption

type RunOption = app.RunOption

func WithTLSConfig

func WithTLSConfig(config *tls.Config) RunOption

func WithTLSKeyPair

func WithTLSKeyPair(certFile, keyFile string) RunOption

func WithUnaryInterceptor

func WithUnaryInterceptor(interceptor grpc.UnaryServerInterceptor) RunOption

Directories

Path Synopsis
cmd
tron Module
example module
internal
admin
Code generated for package admin by go-bindata DO NOT EDIT.
Code generated for package admin by go-bindata DO NOT EDIT.
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL