File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,6 @@ function layerServeFixture(
105105) {
106106 const writes : Array < ReadonlyArray < string > > = [ ] ;
107107 const serveStatus = JSON . stringify ( {
108- ...extra ,
109108 TCP : { "443" : listener } ,
110109 Web : {
111110 "desktop.tail.ts.net:443" : {
@@ -115,6 +114,7 @@ function layerServeFixture(
115114 } ,
116115 } ,
117116 } ,
117+ ...extra ,
118118 } ) ;
119119 const layer = layerMockSpawner ( ( _command , args ) => {
120120 if ( args . join ( " " ) === "serve status --json" ) {
@@ -327,10 +327,18 @@ describe("tailscale", () => {
327327 } ) ;
328328 } ) ;
329329
330- it . effect ( "leaves Funnel and foreground handlers untouched" , ( ) =>
330+ it . effect ( "leaves Funnel, foreground and ambiguous hostname mappings untouched" , ( ) =>
331331 Effect . gen ( function * ( ) {
332332 for ( const extra of [
333333 { AllowFunnel : { "desktop.tail.ts.net:443" : true } } ,
334+ {
335+ Web : {
336+ "old.tail.ts.net:443" : { Handlers : { "/" : { Proxy : "http://127.0.0.1:3773" } } } ,
337+ "desktop.tail.ts.net:443" : {
338+ Handlers : { "/" : { Proxy : "http://another-server:3774" } } ,
339+ } ,
340+ } ,
341+ } ,
334342 {
335343 Foreground : {
336344 session : {
Original file line number Diff line number Diff line change @@ -535,9 +535,13 @@ const servePortHolder = (
535535 ) {
536536 return { _tag : "other" } ;
537537 }
538- for ( const [ hostPort , web ] of Object . entries ( scope . Web ?? { } ) ) {
539- if ( ! hostPort . endsWith ( `:${ servePort } ` ) ) continue ;
540- if ( scope !== config ) return { _tag : "other" } ;
538+ const webEntries = Object . entries ( scope . Web ?? { } ) . filter ( ( [ hostPort ] ) =>
539+ hostPort . endsWith ( `:${ servePort } ` ) ,
540+ ) ;
541+ if ( webEntries . length > 1 || ( scope !== config && webEntries . length > 0 ) ) {
542+ return { _tag : "other" } ;
543+ }
544+ for ( const [ , web ] of webEntries ) {
541545 const root = web . Handlers ?. [ "/" ] ;
542546 if ( root !== undefined ) {
543547 return root . Proxy !== undefined ? { _tag : "proxy" , target : root . Proxy } : { _tag : "other" } ;
You can’t perform that action at this time.
0 commit comments