Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Setup SourceUnit interface (#1393)
Miccahe12f0f84a13f
diff --git a/pkg/sources/source_unit.go b/pkg/sources/source_unit.gonew file mode 100644index 000000000..0c05858a2--- /dev/null+++ b/pkg/sources/source_unit.go@@ -0,0 +1,12 @@+package sources++// CommonSourceUnit is a common implementation of SourceUnit that Sources can+// use instead of implementing their own types.+type CommonSourceUnit struct {+ ID string `json:"source_unit_id"`+}++// Implement the SourceUnit interface.+func (c CommonSourceUnit) SourceUnitID() string {+ return c.ID+}diff --git a/pkg/sources/sources.go b/pkg/sources/sources.goindex cdfe879a3..3d02acf8a 100644--- a/pkg/sources/sources.go+++ b/pkg/sources/sources.go@@ -44,6 +44,19 @@ type Source interface {GetProgress() *Progress}+// SourceUnitUnmarshaller defines an optional interface a Source can implement+// to support units coming from an external source.+type SourceUnitUnmarshaller interface {+ UnmarshalSourceUnit(data []byte) (SourceUnit, error)+}++// SourceUnit is an object that represents a Source's unit of work. This is+// used as the output of enumeration, progress reporting, and job distribution.+type SourceUnit interface {+ // SourceUnitID uniquely identifies a source unit.+ SourceUnitID() string+}+// GCSConfig defines the optional configuration for a GCS source.type GCSConfig struct {// CloudCred determines whether to use cloud credentials.