session

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

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(ctx context.Context, 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.
Package secrets is a generated protocol buffer package.
Package secrets is a generated protocol buffer package.
Package sshforward is a generated protocol buffer package.
Package sshforward is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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