| 1 | package rsyncdconfigscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/ |
| 2 | |
| 3 | import ( |
| 4 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 5 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 6 | |
| 7 | "github.com/BurntSushi/tomlscip-go gomod github.com/BurntSushi/toml v1.6.0 `github.com/BurntSushi/toml`/" |
| 8 | "github.com/gokrazy/rsync/rsyncdscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/" |
| 9 | ) |
| 10 | |
| 11 | type SSHListenerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/SSHListener# struct { |
| 12 | Addressscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/SSHListener#Address. string `toml:"address"` |
| 13 | AuthorizedKeysscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/SSHListener#AuthorizedKeys. string `toml:"authorized_keys"` |
| 14 | } |
| 15 | |
| 16 | type Listenerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener# struct { |
| 17 | HostKeyPathscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#HostKeyPath. string `toml:"host_key_path"` |
| 18 | Rsyncdscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#Rsyncd. string `toml:"rsyncd"` |
| 19 | HTTPMonitoringscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#HTTPMonitoring. string `toml:"http_monitoring"` |
| 20 | AnonSSHscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#AnonSSH. string `toml:"anon_ssh"` |
| 21 | AuthorizedSSHscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#AuthorizedSSH. SSHListenerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/SSHListener# `toml:"authorized_ssh"` |
| 22 | } |
| 23 | |
| 24 | type Configscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config# struct { |
| 25 | Listenersscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#Listeners. []Listenerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener# `toml:"listener"` |
| 26 | Modulesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#Modules. []rsyncdscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/.Modulescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module# `toml:"module"` |
| 27 | DontNamespacescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#DontNamespace. bool `toml:"dont_namespace"` |
| 28 | } |
| 29 | |
| 30 | func FromStringscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/FromString().(input string) (*Configscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#, error) { |
| 31 | var cfg Configscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config# |
| 32 | if _, err := tomlscip-go gomod github.com/BurntSushi/toml v1.6.0 `github.com/BurntSushi/toml`/.Decodescip-go gomod github.com/BurntSushi/toml v1.6.0 `github.com/BurntSushi/toml`/Decode().(input, &cfg); err != nil { |
| 33 | return nil, err |
| 34 | } |
| 35 | return &cfg, nil |
| 36 | } |
| 37 | |
| 38 | func FromFilescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/FromFile().(path string) (*Configscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#, error) { |
| 39 | input, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25.0 os/ReadFile().(path) |
| 40 | if err != nil { |
| 41 | return nil, err |
| 42 | } |
| 43 | return FromStringscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/FromString().(string(input)) |
| 44 | } |
| 45 | |
| 46 | func FromDefaultFilesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/FromDefaultFiles().() (*Configscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#, string, error) { |
| 47 | configDir, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.UserConfigDirscip-go gomod github.com/golang/go/src go1.25.0 os/UserConfigDir().() |
| 48 | if err != nil { |
| 49 | return nil, "", err |
| 50 | } |
| 51 | fn := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(configDir, "gokr-rsyncd.toml") |
| 52 | cfg, err := FromFilescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/FromFile().(fn) |
| 53 | if err != nil { |
| 54 | return nil, "", err |
| 55 | } |
| 56 | return cfg, fn, nil |
| 57 | } |