syncpki

package
v1.5.10 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: BSD-3-Clause Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ERROR_RRDP_UNKNOWN = iota
	ERROR_RRDP_FETCH
)
View Source
const ResponseLimit int64 = 1000000000 // (5Gb)
View Source
const (
	RsyncProtoPrefix = "rsync://"
)

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 ExtractFilePathFromRsyncURL added in v1.4.4

func ExtractFilePathFromRsyncURL(url string) (string, error)

func ExtractFoldersPathFromRsyncURL added in v1.4.4

func ExtractFoldersPathFromRsyncURL(url string) (string, error)

func ExtractRsyncDomainModule added in v1.2.0

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

func FetchFile

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

func FilterMatch

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

Determines if file has been deleted

func GetLocalPath added in v1.4.3

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

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

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
}

func RunRsync added in v1.4.4

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

Runs the rsync binary on a URL

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 NewHTTPFetcher added in v1.4.4

func NewHTTPFetcher(userAgent string) *HTTPFetcher

func (*HTTPFetcher) GetXML

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

type LocalFetch

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

func NewLocalFetch added in v1.2.0

func NewLocalFetch(basepath string) *LocalFetch

func (*LocalFetch) GetFile

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

func (*LocalFetch) GetFileConv

func (s *LocalFetch) GetFileConv(file *pki.PKIFile, derEncoding 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 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