syncpki

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: BSD-3-Clause Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ERROR_RRDP_UNKNOWN = iota
	ERROR_RRDP_FETCH
)
View Source
const ResponseLimit int64 = 1000000000 // (5Gb)

Variables

View Source
var (
	ErrorTypeToName = map[int]string{
		ERROR_RRDP_UNKNOWN: "unknown",
		ERROR_RRDP_FETCH:   "fetch",
	}
)

Functions

func AddInMap

func AddInMap(item string, m map[string]SubMap)

func DecodeRRDPBase64

func DecodeRRDPBase64(value string) ([]byte, error)

func ExtractRsyncDomainModule added in v1.2.0

func ExtractRsyncDomainModule(rsync string) (string, string, error)

func FetchFile

func FetchFile(path string, conv bool) ([]byte, []byte, error)

func FilterMatch

func FilterMatch(line string) (string, bool, error)

Determines if file has been deleted

func GetDownloadPath

func GetDownloadPath(sync string, trimFile bool) (string, error)

func GetMatch

func GetMatch(str string) bool

Check if string is a file

func ParseMapDirectory

func ParseMapDirectory(mapdir string) map[string]string

func ParseNode

func ParseNode(data string) ([]Cert, []Cert, error)

func ReduceMap

func ReduceMap(m map[string]SubMap) []string

func ReplacePath

func ReplacePath(file *pki.PKIFile, replace map[string]string) string

func ReplaceString

func ReplaceString(pathRep string, replace map[string]string) string

Types

type Cert

type Cert struct {
	URI   string `xml:"uri,attr"`
	Value string `xml:",chardata"`
}

type Delta

type Delta struct {
	RootNode
	XMLName  xml.Name `xml:"delta"`
	Publish  []Cert   `xml:"publish"`
	Withdraw []Cert   `xml:"withdraw"`
}

type ElNode

type ElNode struct {
	Serial int64  `xml:"serial,attr"`
	URI    string `xml:"uri,attr"`
	Hash   string `xml:"hash,attr"`
}

type FileStat

type FileStat struct {
	Path    string
	Deleted bool
}

type Frame added in v1.2.0

type Frame uintptr

func StackTrace added in v1.2.0

func StackTrace(s *stack) []Frame

This function returns the Stacktrace of the error. The naming scheme corresponds to what Sentry fetches https://github.com/getsentry/sentry-go/blob/master/stacktrace.go#L49

type HTTPFetcher

type HTTPFetcher struct {
	UserAgent string
	Client    *http.Client
}

func (*HTTPFetcher) GetXML

func (f *HTTPFetcher) GetXML(url string) (string, error)

type LocalFetch

type LocalFetch struct {
	MapDirectory map[string]string
	Log          Logger
	// contains filtered or unexported fields
}

func NewLocalFetch added in v1.2.0

func NewLocalFetch(mapDirectory map[string]string, log Logger) *LocalFetch

func (*LocalFetch) GetFile

func (s *LocalFetch) GetFile(file *pki.PKIFile) (*pki.SeekFile, error)

func (*LocalFetch) GetFileConv

func (s *LocalFetch) GetFileConv(file *pki.PKIFile, convert bool) (*pki.SeekFile, error)

func (*LocalFetch) GetRepository

func (s *LocalFetch) GetRepository(file *pki.PKIFile, callback pki.CallbackExplore) error

func (*LocalFetch) SetRepositories added in v1.2.0

func (s *LocalFetch) SetRepositories(repositories map[string]time.Time)

type Logger

type Logger interface {
	Infof(string, ...interface{})
	Info(...interface{})
	Debugf(string, ...interface{})
	Debug(...interface{})
	Errorf(string, ...interface{})
	Error(...interface{})
}

type Notification

type Notification struct {
	RootNode
	XMLName  xml.Name `xml:"notification"`
	Snapshot ElNode   `xml:"snapshot"`
	Deltas   []ElNode `xml:"delta"`
}

func ParseRoot

func ParseRoot(data string) (Notification, error)

type RRDPError added in v1.2.0

type RRDPError struct {
	EType int

	InnerErr error
	Message  string

	Request *http.Request

	URL, Rsync string

	Stack *stack
}

func NewRRDPErrorFetch added in v1.2.0

func NewRRDPErrorFetch(request *http.Request, err error) *RRDPError

func (*RRDPError) Error added in v1.2.0

func (e *RRDPError) Error() string

func (*RRDPError) SetSentryScope added in v1.2.0

func (e *RRDPError) SetSentryScope(scope *sentry.Scope)

func (*RRDPError) SetURL added in v1.2.0

func (e *RRDPError) SetURL(rrdp, rsync string)

func (*RRDPError) StackTrace added in v1.2.0

func (e *RRDPError) StackTrace() []Frame

type RRDPFetcher

type RRDPFetcher interface {
	GetXML(string) (string, error)
}

type RRDPFile

type RRDPFile func(main string, url string, path string, data []byte, withdraw bool, snapshot bool, curId int64, args ...interface{}) error

type RRDPSystem

type RRDPSystem struct {
	Log     Logger
	Fetcher RRDPFetcher

	Callback RRDPFile

	Path      string
	SessionID string
	Serial    int64
	// contains filtered or unexported fields
}

func (*RRDPSystem) FetchRRDP

func (s *RRDPSystem) FetchRRDP(cbArgs ...interface{}) error

func (*RRDPSystem) SetSentryScope added in v1.2.0

func (s *RRDPSystem) SetSentryScope(scope *sentry.Scope)

type RootNode

type RootNode struct {
	Xmlns     string `xml:"xmlns,attr"`
	Version   string `xml:"version,attr"`
	SessionID string `xml:"session_id,attr"`
	Serial    int64  `xml:"serial,attr"`
}

type RsyncSystem

type RsyncSystem struct {
	Log Logger
}

func (*RsyncSystem) RunRsync

func (s *RsyncSystem) RunRsync(ctx context.Context, uri string, bin string, dirPath string) ([]*FileStat, error)

Runs the rsync binary on a URL

type Snapshot

type Snapshot struct {
	RootNode
	XMLName  xml.Name `xml:"snapshot"`
	Publish  []Cert   `xml:"publish"`
	Withdraw []Cert   `xml:"withdraw"`
}

type SubMap

type SubMap struct {
	Subitem map[string]SubMap
	Count   int
}

Jump to

Keyboard shortcuts

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