gateway

package
v0.0.0-...-9853328 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptionPolicy

func OptionPolicy() gatewayOption

Types

type NullPolicy

type NullPolicy struct{}

func (NullPolicy) AppendRule

func (NullPolicy) AppendRule(string, ...rule.Rule)

func (NullPolicy) Auth

func (NullPolicy) Auth(*metadata.MD, string) error

func (NullPolicy) Policy

func (null NullPolicy) Policy() Policy

func (NullPolicy) SetRule

func (NullPolicy) SetRule(string, ...rule.Rule)

func (NullPolicy) String

func (NullPolicy) String() string

type PermPolicy

type PermPolicy interface {
	Policy() Policy
	Auth(ctx *metadata.MD, method string) error
	SetRule(key string, v ...rule.Rule)
	AppendRule(key string, v ...rule.Rule)
	String() string
}

type Policy

type Policy int
const (
	PolicyNULL Policy = iota
	PolicyRouter
	PolicyUser
)

func (Policy) String

func (p Policy) String() string

type RouterPolicy

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

func NewRouterPolicy

func NewRouterPolicy() *RouterPolicy

func (*RouterPolicy) AppendRule

func (p *RouterPolicy) AppendRule(key string, tokens ...rule.Rule)

func (*RouterPolicy) Auth

func (p *RouterPolicy) Auth(ctx *metadata.MD, method string) error

func (*RouterPolicy) Policy

func (*RouterPolicy) Policy() Policy

func (*RouterPolicy) SetRule

func (p *RouterPolicy) SetRule(key string, tokens ...rule.Rule)

func (*RouterPolicy) String

func (p *RouterPolicy) String() string

type Rule

type Rule struct {
	Type  string         `json:"type"`
	Name  string         `json:"name"`
	Token map[string]any `json:"token"`
}

type UserPolicy

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

func NewUserPolicy

func NewUserPolicy() *UserPolicy

func (*UserPolicy) AppendRule

func (p *UserPolicy) AppendRule(key string, tokens ...rule.Rule)

func (*UserPolicy) Auth

func (p *UserPolicy) Auth(ctx *metadata.MD, method string) error

func (*UserPolicy) Policy

func (*UserPolicy) Policy() Policy

func (*UserPolicy) SetRule

func (p *UserPolicy) SetRule(key string, tokens ...rule.Rule)

func (*UserPolicy) String

func (p *UserPolicy) String() string

type YockdGateWay

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

func New

func New() *YockdGateWay

func (*YockdGateWay) AddRule

func (gate *YockdGateWay) AddRule(str []byte) error

func (*YockdGateWay) DelRule

func (gate *YockdGateWay) DelRule(str []byte) error

func (*YockdGateWay) GuardStream

func (gate *YockdGateWay) GuardStream() grpc.ServerOption

func (*YockdGateWay) GuardTransport

func (gate *YockdGateWay) GuardTransport(c, k string, cas ...string) grpc.ServerOption

func (*YockdGateWay) GuardUnary

func (gate *YockdGateWay) GuardUnary() grpc.ServerOption

func (*YockdGateWay) SetAgent

func (gate *YockdGateWay) SetAgent(name string, agent agent.RuleAgent)

func (*YockdGateWay) SetPolicy

func (gate *YockdGateWay) SetPolicy(p PermPolicy)

func (*YockdGateWay) SetRule

func (gate *YockdGateWay) SetRule(key string, rules ...string)

func (*YockdGateWay) UnsetRule

func (gate *YockdGateWay) UnsetRule(key string, rules ...string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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