This moves all of the tcp target functionality into a tcp package. It also establishes a Register function in the target package to allow specific target types to be registered at initilazation time. When registering, a target type needs to provide its Subtype, as well as some RepositoryHooks that are used by the target Repository.
20 lines
529 B
Go
20 lines
529 B
Go
package tcp
|
|
|
|
import "github.com/hashicorp/boundary/internal/target"
|
|
|
|
// Expose functions and variables for tests.
|
|
var (
|
|
TestId = testId
|
|
TestTargetName = testTargetName
|
|
DefaultTableName = defaultTableName
|
|
)
|
|
|
|
// NewTestTarget is a test helper that bypasses the scopeId checks
|
|
// performed by NewTarget, allowing tests to create Targets with
|
|
// nil scopeIds for more robust testing.
|
|
func NewTestTarget(scopeId string, opt ...target.Option) *Target {
|
|
t, _ := New("testScope", opt...)
|
|
t.ScopeId = scopeId
|
|
return t
|
|
}
|