grpcp

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 17 Imported by: 0

README

grpcp

Description

This is a simple tool to copy files between local and remote hosts using gRPC stream.

Usage

Usage: grpcp [<src> [<dest>]]

Arguments:
  [<src>]
  [<dest>]

Flags:
  -h, --help         Show context-sensitive help.
  -p, --port=8022    port number
  -l, --listen=""    listen address
  -s, --server       run as server
  -q, --quiet        quiet mode for client

Start the server on the remote host:

$ grpcp --server
Examples

Copy a file from the remote host to the local host:

$ grpcp remote_host:/path/to/file /path/to/destination

Copy a file from the local host to the remote host:

$ grpcp /path/to/file remote_host:/path/to/destination

TODO

  • Use TLS encryption for the connection

LICENSE

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StreamBufferSize = 1024 * 1024
)

Functions

func RunCLI

func RunCLI(ctx context.Context) error

func RunServer

func RunServer(ctx context.Context, opt *ServerOption) error

Types

type CLI

type CLI struct {
	Host string `name:"host" short:"h" default:"localhost" help:"host name"`
	Port int    `name:"port" short:"p" default:"8022" help:"port number"`

	Server bool `name:"server" short:"s" help:"run as server"`
	Quiet  bool `name:"quiet" short:"q" help:"quiet mode for client"`
	Kill   bool `name:"kill" short:"k" help:"kill server"`

	Src  string `arg:"" optional:"" name:"src" short:"s" description:"source file path"`
	Dest string `arg:"" optional:"" name:"dest" short:"d" description:"destination file path"`
}

type Client

type Client struct {
	Option *ClientOption
}

func NewClient

func NewClient(opt *ClientOption) *Client

func (*Client) Copy

func (c *Client) Copy(ctx context.Context, src, dest string) error

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (*pb.PingResponse, error)

func (*Client) Shutdown added in v0.0.5

func (c *Client) Shutdown(ctx context.Context) error

type ClientOption

type ClientOption struct {
	Host  string `json:"host"`
	Port  int    `json:"port"`
	Quiet bool   `json:"quiet"`
}

type ServerOption

type ServerOption struct {
	Port   int    `json:"port"`
	Listen string `json:"listen"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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