Documentation
¶
Overview ¶
Package rsyncd implements an rsync server (only), but note that gokrazy/rsync contains a native Go rsync implementation that supports sending and receiving files as client or server, compatible with the original tridge rsync (from the samba project) or openrsync (used on OpenBSD and macOS 15+).
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option specifies the server options.
func WithLogger ¶
WithLogger specifies the logger to use for the server. It also sets the global logger used by the rsync package.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
Example ¶
package main import ( "context" "log" "net" "time" "github.com/gokrazy/rsync/rsyncd" ) func main() { // simulate user (or process supervisor) asking us to stop soon after starting ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) defer cancel() listener, err := net.Listen("tcp", "localhost:873") if err != nil { log.Fatal(err) } rsyncServer, err := rsyncd.NewServer([]rsyncd.Module{ { Name: "music", Path: "/home/bob/Music", }, }) if err != nil { log.Fatal(err) } if err := rsyncServer.Serve(ctx, listener); err != nil { log.Fatal(err) } log.Println("gracefully exiting") }
Output:
func (*Server) HandleConn ¶
func (s *Server) HandleConn(module *Module, rd io.Reader, crd *rsyncwire.CountingReader, cwr *rsyncwire.CountingWriter, paths []string, opts *rsyncopts.Options, negotiate bool) (err error)
handleConn is equivalent to rsync/main.c:start_server
func (*Server) HandleDaemonConn ¶
func (s *Server) HandleDaemonConn(ctx context.Context, conn io.ReadWriter, remoteAddr net.Addr) (err error)
FIXME: context cancellation not yet implemented
Click to show internal directories.
Click to hide internal directories.