Skip to content

Commit

Permalink
use downstream direct remote address
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick0308 authored and chaojiang committed May 25, 2023
1 parent 5065529 commit 0ca18e5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ func accessLogHandler(logEntry []*data_accesslog.HTTPAccessLogEntry, ipToSvcCach

func fetchSourceIp(entry *data_accesslog.HTTPAccessLogEntry) (string, error) {
log := log.WithField("reporter", "accesslog convertor").WithField("function", "fetchSourceIp")
if entry.CommonProperties.DownstreamRemoteAddress == nil {
log.Debugf("DownstreamRemoteAddress is nil, skip")
if entry.CommonProperties.DownstreamDirectRemoteAddress == nil {
log.Debugf("DownstreamDirectRemoteAddress is nil, skip")
return "", nil
}
downstreamSock, ok := entry.CommonProperties.DownstreamRemoteAddress.Address.(*envoy_config_core.Address_SocketAddress)
downstreamSock, ok := entry.CommonProperties.DownstreamDirectRemoteAddress.Address.(*envoy_config_core.Address_SocketAddress)
if !ok {
return "", stderrors.New("wrong type of DownstreamRemoteAddress")
return "", stderrors.New("wrong type of DownstreamDirectRemoteAddress")
}
if downstreamSock == nil || downstreamSock.SocketAddress == nil {
return "", stderrors.New("downstream socket address is nil")
Expand Down

0 comments on commit 0ca18e5

Please sign in to comment.