core

package
v0.0.0-...-60dc3e1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const PluginName = "ratte-core"

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "is-ratte-core",
	MagicCookieValue: "true",
}

Functions

This section is empty.

Types

type AddNodeParams

type AddNodeParams struct {
	Name          string
	NodeInfo      *NodeInfo
	TlsOptions    TlsOptions
	ExpandOptions []byte
}

type AddUsersParams

type AddUsersParams struct {
	NodeName string
	Users    []UserInfo
	params2.ExpandParams
}

type Core

type Core interface {
	Start(dataPath string, config []byte) error
	Close() error
	AddNode(params *AddNodeParams) error
	DelNode(name string) error
	AddUsers(p *AddUsersParams) error
	GetUserTraffic(p *GetUserTrafficParams) *GetUserTrafficResponse
	ResetUserTraffic(p *ResetUserTrafficParams) error
	DelUsers(params *DelUsersParams) error
	Protocols() []string
	Type() string
}

type DelUsersParams

type DelUsersParams struct {
	NodeName string
	Users    []string
}

type GetUserTrafficParams

type GetUserTrafficParams struct {
	NodeName string
	Username string
}

type GetUserTrafficResponse

type GetUserTrafficResponse struct {
	Up   int64
	Down int64
	Err  error
}

type NodeInfo

type NodeInfo params.NodeInfo

type Plugin

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

func NewPlugin

func NewPlugin(c Core) *Plugin

func (*Plugin) Client

func (_ *Plugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*Plugin) Server

func (p *Plugin) Server(_ *plugin.MuxBroker) (interface{}, error)

type PluginClient

type PluginClient struct {
	Core
	*baseplugin.Client
}

func NewClient

func NewClient(l hclog.Logger, cmd *exec.Cmd) (client *PluginClient, err error)

func (*PluginClient) Close

func (c *PluginClient) Close() error

type PluginImplClient

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

func (*PluginImplClient) AddNode

func (c *PluginImplClient) AddNode(params *AddNodeParams) (err error)

func (*PluginImplClient) AddUsers

func (c *PluginImplClient) AddUsers(p *AddUsersParams) (err error)

func (*PluginImplClient) Close

func (c *PluginImplClient) Close() (err error)

func (*PluginImplClient) DelNode

func (c *PluginImplClient) DelNode(name string) (err error)

func (*PluginImplClient) DelUsers

func (c *PluginImplClient) DelUsers(params *DelUsersParams) (err error)

func (*PluginImplClient) GetUserTraffic

func (c *PluginImplClient) GetUserTraffic(p *GetUserTrafficParams) (rsp *GetUserTrafficResponse)

func (*PluginImplClient) Protocols

func (c *PluginImplClient) Protocols() (ps []string)

func (*PluginImplClient) ResetUserTraffic

func (c *PluginImplClient) ResetUserTraffic(p *ResetUserTrafficParams) (err error)

func (*PluginImplClient) Start

func (c *PluginImplClient) Start(dataPath string, config []byte) (err error)

func (*PluginImplClient) Type

func (c *PluginImplClient) Type() (t string)

type PluginImplServer

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

func (*PluginImplServer) AddNode

func (s *PluginImplServer) AddNode(params *AddNodeParams, err *error) error

func (*PluginImplServer) AddUsers

func (s *PluginImplServer) AddUsers(params *AddUsersParams, err *error) error

func (*PluginImplServer) Close

func (s *PluginImplServer) Close(_ interface{}, err *error) error

func (*PluginImplServer) DelNode

func (s *PluginImplServer) DelNode(name string, err *error) error

func (*PluginImplServer) DelUsers

func (s *PluginImplServer) DelUsers(params *DelUsersParams, err *error) error

func (*PluginImplServer) GetUserTraffic

func (s *PluginImplServer) GetUserTraffic(params *GetUserTrafficParams, rsp *GetUserTrafficResponse) error

func (*PluginImplServer) Protocols

func (s *PluginImplServer) Protocols(_ interface{}, rsp *[]string) error

func (*PluginImplServer) ResetUserTraffic

func (s *PluginImplServer) ResetUserTraffic(p *ResetUserTrafficParams, err *error) error

func (*PluginImplServer) Start

func (s *PluginImplServer) Start(p *StartParams, err *error) error

func (*PluginImplServer) Type

func (s *PluginImplServer) Type(_ interface{}, t *string) error

type PluginServer

type PluginServer struct {
	*baseplugin.Server
}

func NewServer

func NewServer(l hclog.Logger, c Core) (*PluginServer, error)

type ResetUserTrafficParams

type ResetUserTrafficParams struct {
	NodeName string
	Username string
}

type StartParams

type StartParams struct {
	DataPath string
	Config   []byte
}

type TlsOptions

type TlsOptions struct {
	CertPath string
	KeyPath  string
}

type UserInfo

type UserInfo params2.UserInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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