@@ -472,6 +472,19 @@ func (n Upstream) MarshalJSON() ([]byte, error) {
472472 return json .Marshal ((Alias )(n ))
473473}
474474
475+ func ComposeSSLName (kind , namespace , name string ) string {
476+ p := make ([]byte , 0 , len (kind )+ len (namespace )+ len (name )+ 2 )
477+ buf := bytes .NewBuffer (p )
478+
479+ buf .WriteString (kind )
480+ buf .WriteByte ('_' )
481+ buf .WriteString (namespace )
482+ buf .WriteByte ('_' )
483+ buf .WriteString (name )
484+
485+ return buf .String ()
486+ }
487+
475488// ComposeRouteName uses namespace, name and rule name to compose
476489// the route name.
477490func ComposeRouteName (namespace , name string , rule string ) string {
@@ -491,18 +504,22 @@ func ComposeRouteName(namespace, name string, rule string) string {
491504
492505// ComposeStreamRouteName uses namespace, name and rule name to compose
493506// the stream_route name.
494- func ComposeStreamRouteName (namespace , name string , rule string ) string {
507+ func ComposeStreamRouteName (namespace , name string , rule string , typ string ) string {
508+ if typ == "" {
509+ typ = "TCP"
510+ }
495511 // FIXME Use sync.Pool to reuse this buffer if the upstream
496512 // name composing code path is hot.
497- p := make ([]byte , 0 , len (namespace )+ len (name )+ len (rule )+ 6 )
513+ p := make ([]byte , 0 , len (namespace )+ len (name )+ len (rule )+ len ( typ ) + 3 )
498514 buf := bytes .NewBuffer (p )
499515
500516 buf .WriteString (namespace )
501517 buf .WriteByte ('_' )
502518 buf .WriteString (name )
503519 buf .WriteByte ('_' )
504520 buf .WriteString (rule )
505- buf .WriteString ("_tcp" )
521+ buf .WriteByte ('_' )
522+ buf .WriteString (typ )
506523
507524 return buf .String ()
508525}
@@ -545,8 +562,8 @@ func ComposeServicesNameWithScheme(namespace, name string, rule string, scheme s
545562 return buf .String ()
546563}
547564
548- func ComposeServiceNameWithStream (namespace , name string , rule string ) string {
549- return ComposeServicesNameWithScheme (namespace , name , rule , "stream" )
565+ func ComposeServiceNameWithStream (namespace , name string , rule , typ string ) string {
566+ return ComposeServicesNameWithScheme (namespace , name , rule , typ )
550567}
551568
552569func ComposeConsumerName (namespace , name string ) string {
0 commit comments