grpc

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWoodpeckerServer

func NewWoodpeckerServer(forge forge.Forge, queue queue.Queue, logger logging.Log, pubsub pubsub.Publisher, store store.Store, host string) proto.WoodpeckerServer

Types

type AgentTokenClaims

type AgentTokenClaims struct {
	jwt.RegisteredClaims
	AgentID int64 `json:"agent_id"`
}

UserClaims is a custom JWT claims that contains some user's information

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(jwtManager *JWTManager) *Authorizer

func (*Authorizer) StreamInterceptor

func (a *Authorizer) StreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func (*Authorizer) UnaryInterceptor

func (a *Authorizer) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

type JWTManager

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

JWTManager is a JSON web token manager

func NewJWTManager

func NewJWTManager(secretKey string) *JWTManager

NewJWTManager returns a new JWT manager

func (*JWTManager) Generate

func (manager *JWTManager) Generate(agentID int64) (string, error)

Generate generates and signs a new token for a user

func (*JWTManager) Verify

func (manager *JWTManager) Verify(accessToken string) (*AgentTokenClaims, error)

Verify verifies the access token string and return a user claim if the token is valid

type RPC

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

func (*RPC) Done

func (s *RPC) Done(c context.Context, id string, state rpc.State) error

Done implements the rpc.Done function

func (*RPC) Extend

func (s *RPC) Extend(c context.Context, id string) error

Extend implements the rpc.Extend function

func (*RPC) Init

func (s *RPC) Init(c context.Context, id string, state rpc.State) error

Init implements the rpc.Init function

func (*RPC) Log

func (s *RPC) Log(c context.Context, _logEntry *rpc.LogEntry) error

Log implements the rpc.Log function

func (*RPC) Next

func (s *RPC) Next(c context.Context, agentFilter rpc.Filter) (*rpc.Pipeline, error)

Next implements the rpc.Next function

func (*RPC) RegisterAgent

func (s *RPC) RegisterAgent(ctx context.Context, platform, backend, version string, capacity int32) (int64, error)

func (*RPC) ReportHealth

func (s *RPC) ReportHealth(ctx context.Context, status string) error

func (*RPC) Update

func (s *RPC) Update(c context.Context, id string, state rpc.State) error

Update implements the rpc.Update function

func (*RPC) Wait

func (s *RPC) Wait(c context.Context, id string) error

Wait implements the rpc.Wait function

type StreamContextWrapper

type StreamContextWrapper interface {
	grpc.ServerStream
	SetContext(context.Context)
}

type WoodpeckerAuthServer

type WoodpeckerAuthServer struct {
	proto.UnimplementedWoodpeckerAuthServer
	// contains filtered or unexported fields
}

func NewWoodpeckerAuthServer

func NewWoodpeckerAuthServer(jwtManager *JWTManager, agentMasterToken string, store store.Store) *WoodpeckerAuthServer

func (*WoodpeckerAuthServer) Auth

type WoodpeckerServer

type WoodpeckerServer struct {
	proto.UnimplementedWoodpeckerServer
	// contains filtered or unexported fields
}

WoodpeckerServer is a grpc server implementation.

func (*WoodpeckerServer) Done

func (*WoodpeckerServer) Extend

func (*WoodpeckerServer) Init

func (*WoodpeckerServer) Log

func (*WoodpeckerServer) Next

func (*WoodpeckerServer) RegisterAgent

func (*WoodpeckerServer) ReportHealth

func (*WoodpeckerServer) Update

func (*WoodpeckerServer) Version

func (*WoodpeckerServer) Wait

Jump to

Keyboard shortcuts

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