rpc

package
v0.0.0-...-69029ee Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodInfo string = "info"
	MethodFile string = "files"
)

Service Methods

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client type

func NewClient

func NewClient(conn io.ReadWriteCloser) *Client

NewClient creates a new Client

func (*Client) FileDownload

func (c *Client) FileDownload(filename string, downloadDir string) error

FileDownload downloads a file

func (*Client) FileUpload

func (c *Client) FileUpload(filename string) error

FileUpload uploads a file

func (*Client) InfoVersion

func (c *Client) InfoVersion() (string, error)

InfoVersion requests server version info

type FileAPI

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

FileAPI type

func NewFileAPI

func NewFileAPI(dirPath string) *FileAPI

NewFileAPI creates a new FileAPI

func (*FileAPI) Download

func (api *FileAPI) Download(fp *FilePayload, reply *FilePayload) error

Download a file

func (*FileAPI) Upload

func (api *FileAPI) Upload(fp *FilePayload, reply *struct{}) error

Upload a file

type FilePayload

type FilePayload struct {
	Name string
	Data []byte
}

FilePayload type

type InfoAPI

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

InfoAPI type

func NewInfoAPI

func NewInfoAPI(versionInfo string) *InfoAPI

NewInfoAPI creates a new InfoAPI

func (*InfoAPI) Version

func (api *InfoAPI) Version(req *struct{}, reply *string) error

Version handler

type Server

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

Server type

func NewServer

func NewServer(versionInfo, dirPath string) *Server

NewServer creates a new Server

func (*Server) Serve

func (s *Server) Serve(ln net.Listener) error

Serve handle rpc requests connections from listeners

func (*Server) ServeConn

func (s *Server) ServeConn(conn net.Conn)

ServeConn serves a connection. It blocks until the connection is closed.

Jump to

Keyboard shortcuts

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