restful

package
v1.0.69 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	C_TlsEnable = "tls.enable"
	C_TlsCert   = "tls.cert"
	C_TlsKey    = "tls.key"
	C_Port      = "port"
)

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(discovery Discovery) titan.IConnection

func NewRestClient

func NewRestClient() *titan.Client

Types

type Connection

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

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) Drain

func (c *Connection) Drain()

func (*Connection) Flush

func (c *Connection) Flush() error

func (*Connection) Publish

func (c *Connection) Publish(subject string, v interface{}) error

func (*Connection) SendRequest

func (c *Connection) SendRequest(rq *titan.Request, subject string) (*titan.Response, error)

func (*Connection) Subscribe added in v1.0.48

func (c *Connection) Subscribe(subject string, cb titan.Handler) (titan.ISubscription, error)

type ConsulDiscovery

type ConsulDiscovery struct {
}

Consul service discovery, not implemented yet

type Discovery

type Discovery interface {
	LookupService(serviceName string) (string, error)
}

type EnvDiscovery

type EnvDiscovery struct {
}

func NewEnvDiscovery

func NewEnvDiscovery() *EnvDiscovery

func (*EnvDiscovery) LookupService

func (d *EnvDiscovery) LookupService(serviceName string) (string, error)

get value from environment variables

type IServer

type IServer interface {
	Stop()
	Start(started ...chan interface{})
}

type Option

type Option func(*Options) error

Option is a function on the options for a connection.

func Cores

func Cores(domains []string) Option

Cores allow cors with domains name

func Logger

func Logger(logger logur.Logger) Option

func Port

func Port(v string) Option

func Routes

func Routes(r func(titan.Router)) Option

func SocketEnable

func SocketEnable(v bool) Option

func SocketRoute

func SocketRoute(path string, h socket.HandlerFunc) Option

func Static

func Static(path, directory string) Option

func TlsCert

func TlsCert(v string) Option

func TlsEnable

func TlsEnable(v bool) Option

func TlsKey

func TlsKey(v string) Option

type Options

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

Options can be used to create a customized connection.

type Server

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

func NewServer

func NewServer(options ...Option) *Server

func (*Server) ServeHTTP

func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

the socket proxy

func (*Server) Start

func (srv *Server) Start(started ...chan interface{})

func (*Server) Stop

func (srv *Server) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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