Skip to content

Commit

Permalink
Refactor and fix early return: HTTP Listener XDS translator (#2981)
Browse files Browse the repository at this point in the history
* refactor

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

* minor change

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
  • Loading branch information
zhaohuabing authored Apr 11, 2024
1 parent cc91a51 commit a24263c
Show file tree
Hide file tree
Showing 2 changed files with 211 additions and 136 deletions.
12 changes: 11 additions & 1 deletion internal/xds/translator/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,17 @@ func buildXdsQuicListener(name, address string, port uint32, accesslog *ir.Acces
return xdsListener
}

func (t *Translator) addXdsHTTPFilterChain(xdsListener *listenerv3.Listener, irListener *ir.HTTPListener,
// addHCMToXDSListener adds a HCM filter to the listener's filter chain, and adds
// all the necessary HTTP filters to that HCM.
//
// - If tls is not enabled, a HCM filter is added to the Listener's default TCP filter chain.
// All the ir HTTP Listeners on the same address + port combination share the
// same HCM + HTTP filters.
// - If tls is enabled, a new TCP filter chain is created and added to the listener.
// A HCM filter is added to the new TCP filter chain.
// The newly created TCP filter chain is configured with a filter chain match to
// match the server names(SNI) based on the listener's hostnames.
func (t *Translator) addHCMToXDSListener(xdsListener *listenerv3.Listener, irListener *ir.HTTPListener,
accesslog *ir.AccessLog, tracing *ir.Tracing, http3Listener bool, connection *ir.Connection) error {
al := buildXdsAccessLog(accesslog, false)

Expand Down
Loading

0 comments on commit a24263c

Please sign in to comment.