2023-03-28 18:39:22 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 18:39:22 +00:00
|
|
|
|
2022-01-20 16:12:04 +00:00
|
|
|
//go:build !consulent
|
|
|
|
|
|
|
|
package proxycfg
|
|
|
|
|
|
|
|
import (
|
2022-04-05 21:10:06 +00:00
|
|
|
"github.com/hashicorp/consul/acl"
|
2022-01-20 16:12:04 +00:00
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
|
|
|
)
|
|
|
|
|
2022-04-29 22:12:51 +00:00
|
|
|
func UpstreamIDString(typ, dc, name string, _ *acl.EnterpriseMeta, peerName string) string {
|
2022-01-20 16:12:04 +00:00
|
|
|
ret := name
|
|
|
|
|
2022-04-29 22:12:51 +00:00
|
|
|
if peerName != "" {
|
|
|
|
ret += "?peer=" + peerName
|
|
|
|
} else if dc != "" {
|
2022-01-20 16:12:04 +00:00
|
|
|
ret += "?dc=" + dc
|
|
|
|
}
|
|
|
|
|
|
|
|
if typ == "" || typ == structs.UpstreamDestTypeService {
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
|
|
|
return typ + ":" + ret
|
|
|
|
}
|
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
func parseInnerUpstreamIDString(input string) (string, *acl.EnterpriseMeta) {
|
2022-01-20 16:12:04 +00:00
|
|
|
return input, structs.DefaultEnterpriseMetaInDefaultPartition()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u UpstreamID) enterpriseIdentifierPrefix() string {
|
|
|
|
return ""
|
|
|
|
}
|