server

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultLogger

func SetDefaultLogger(logger *logrus.Logger)

SetDefaultLogger is to set logger for vpn server.

Types

type AuthorizedContext

type AuthorizedContext struct {
	grpc.ServerStream
	Ctx context.Context
}

AuthorizedContext is a wrapper for stream context in GRPC.

func (*AuthorizedContext) Context

func (rs *AuthorizedContext) Context() context.Context

Context returns an internal context

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is to use a dependency injection for handler.

type OptionFunc

type OptionFunc func(c *config)

OptionFunc is a function for Option interface.

func WithAuthMethods added in v1.3.0

func WithAuthMethods(methods []auth.ServerAuthMethod) OptionFunc

WithAuthMethods returns OptionFunc for inserting GRPC authentication method.

func WithGrpcOptions

func WithGrpcOptions(opts []grpc.ServerOption) OptionFunc

WithGrpcOptions returns OptionFunc for inserting GRPC OPTIONS.

func WithGrpcPort

func WithGrpcPort(port string) OptionFunc

WithGrpcPort returns OptionFunc for inserting GRPC PORT.

func WithGrpcStreamInterceptors

func WithGrpcStreamInterceptors(interceptors []grpc.StreamServerInterceptor) OptionFunc

WithGrpcStreamInterceptors returns OptionFunc for inserting GRPC Stream Interceptors( such as checking header associated JWT ).

func WithGrpcTlsCertification

func WithGrpcTlsCertification(cert string) OptionFunc

WithGrpcTlsCertification returns OptionFunc for inserting GRPC TLS Certification.

func WithGrpcTlsPem

func WithGrpcTlsPem(pem string) OptionFunc

WithGrpcTlsPem returns OptionFunc for inserting GRPC TLS PRIVATE PEM.

func WithGrpcUnaryInterceptors

func WithGrpcUnaryInterceptors(interceptors []grpc.UnaryServerInterceptor) OptionFunc

WithGrpcUnaryInterceptors returns OptionFunc for inserting GRPC Unary Interceptors( such as auth(Google OpenId, AWS IAM) )

func WithVpnJwtExpiration added in v1.0.2

func WithVpnJwtExpiration(exp time.Duration) OptionFunc

WithVpnJwtExpiration returns OptionFunc for inserting VPN expiration time.

func WithVpnJwtSalt

func WithVpnJwtSalt(vpnJwtSalt string) OptionFunc

WithVpnJwtSalt returns OptionFunc for inserting VPN JWT SALT.

func WithVpnSubNet

func WithVpnSubNet(vpnSubNet string) OptionFunc

WithVpnSubNet returns OptionFunc for inserting VPN SUBNET.

type VPN

type VPN interface {
	// Start VPN
	Run() error

	// stop VPN
	Close() error

	GetJwtSalt() string

	// GRPC METHODS
	Exchange(stream protocol.VPN_ExchangeServer) error
	Auth(ctx context.Context, req *protocol.AuthRequest) (*protocol.AuthResponse, error)
}

type VpnServer

type VpnServer interface {
	Run() error
}

VpnServer is an interface for utilizing vpn operations.

func NewVpnServer

func NewVpnServer(opts ...Option) (VpnServer, error)

NewVpnServer returns vpn server.

Jump to

Keyboard shortcuts

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