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

package restic

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

Index

Package Files

restic.go restic_test_utils.go stdio_conn.go stdio_conn_go1.10.go

Variables

var Command = &cobra.Command{
    Use:   "restic remote:path",
    Short: `Serve the remote for restic's REST API.`,
    Long: "" /* 2602 byte string literal not displayed */+
        httplib.Help,
    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
            }
            err := s.Serve()
            if err != nil {
                return err
            }
            s.Wait()
            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)

type TestRequest Uses

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

TestRequest is a sequence of HTTP requests with (optional) tests for the response.

Package restic imports 26 packages (graph) and is imported by 3 packages. Updated 2019-06-25. Refresh now. Tools for package owners.