rclone: github.com/sandeepkru/rclone/cmd/serve/restic Index | Files

package restic

import "github.com/sandeepkru/rclone/cmd/serve/restic"

Package restic serves a remote suitable for use with restic


Package Files

restic.go stdio_conn.go stdio_conn_go1.10.go


var Command = &cobra.Command{
    Use:   "restic remote:path",
    Short: `Serve the remote for restic's REST API.`,
    Long: "" /* 2465 byte string literal not displayed */+
    Run: func(command *cobra.Command, args []string) {
        cmd.CheckArgs(1, 1, command, args)
        f := cmd.NewFsSrc(args)
        cmd.Run(false, true, command, func() error {
            s := newServer(f, &httpflags.Opt)
            if stdio {
                if terminal.IsTerminal(int(os.Stdout.Fd())) {
                    return errors.New("Refusing to run HTTP2 server directly on a terminal, please let restic start rclone")

                conn := &StdioConn{
                    stdin:  os.Stdin,
                    stdout: os.Stdout,

                httpSrv := &http2.Server{}
                opts := &http2.ServeConnOpts{
                    Handler: http.HandlerFunc(s.handler),
                httpSrv.ServeConn(conn, opts)
                return nil

            return nil

Command definition for cobra

type Addr Uses

type Addr struct{}

Addr implements net.Addr for stdin/stdout.

func (Addr) Network Uses

func (a Addr) Network() string

Network returns the network type as a string.

func (Addr) String Uses

func (a Addr) String() string

type StdioConn Uses

type StdioConn struct {
    // contains filtered or unexported fields

StdioConn implements a net.Conn via stdin/stdout.

func (*StdioConn) Close Uses

func (s *StdioConn) Close() error

Close closes both streams.

func (*StdioConn) LocalAddr Uses

func (s *StdioConn) LocalAddr() net.Addr

LocalAddr returns nil.

func (*StdioConn) Read Uses

func (s *StdioConn) Read(p []byte) (int, error)

func (*StdioConn) RemoteAddr Uses

func (s *StdioConn) RemoteAddr() net.Addr

RemoteAddr returns nil.

func (*StdioConn) SetDeadline Uses

func (s *StdioConn) SetDeadline(t time.Time) error

SetDeadline sets the read/write deadline.

func (*StdioConn) SetReadDeadline Uses

func (s *StdioConn) SetReadDeadline(t time.Time) error

SetReadDeadline sets the read/write deadline.

func (*StdioConn) SetWriteDeadline Uses

func (s *StdioConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the read/write deadline.

func (*StdioConn) Write Uses

func (s *StdioConn) Write(p []byte) (int, error)

Package restic imports 25 packages (graph). Updated 2018-07-18. Refresh now. Tools for package owners. This is a quick bug-fix fork (has fewer than three commits, and only during the week it was created).