session

package
v0.0.0-...-ab06b26 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) string

func MethodURL

func MethodURL(s, m string) string

MethodURL returns a gRPC method URL for service and method name

func NewContext

func NewContext(ctx context.Context, id string) context.Context

Types

type Attachable

type Attachable interface {
	Register(*grpc.Server)
}

Attachable defines a feature that can be expsed on a session

type Caller

type Caller interface {
	Context() context.Context
	Supports(method string) bool
	Conn() *grpc.ClientConn
	Name() string
	SharedKey() string
}

Caller can invoke requests on the session

type Dialer

type Dialer func(ctx context.Context, proto string, meta map[string][]string) (net.Conn, error)

Dialer returns a connection that can be used by the session

type Manager

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

Manager is a controller for accessing currently active sessions

func NewManager

func NewManager() (*Manager, error)

NewManager returns a new Manager

func (*Manager) Get

func (sm *Manager) Get(ctx context.Context, id string) (Caller, error)

Get returns a session by ID

func (*Manager) HandleConn

func (sm *Manager) HandleConn(ctx context.Context, conn net.Conn, opts map[string][]string) error

HandleConn handles an incoming raw connection

func (*Manager) HandleHTTPRequest

func (sm *Manager) HandleHTTPRequest(ctx context.Context, w http.ResponseWriter, r *http.Request) error

HandleHTTPRequest handles an incoming HTTP request

type Session

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

Session is a long running connection between client and a daemon

func NewSession

func NewSession(name, sharedKey string) (*Session, error)

NewSession returns a new long running session

func (*Session) Allow

func (s *Session) Allow(a Attachable)

Allow enable a given service to be reachable through the grpc session

func (*Session) Close

func (s *Session) Close() error

Close closes the session

func (*Session) ID

func (s *Session) ID() string

ID returns unique identifier for the session

func (*Session) Run

func (s *Session) Run(ctx context.Context, dialer Dialer) error

Run activates the session

Directories

Path Synopsis
Package auth is a generated protocol buffer package.
Package auth is a generated protocol buffer package.
Package filesync is a generated protocol buffer package.
Package filesync is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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