diff --git a/gatewayd.yaml b/gatewayd.yaml index 625a611c..0c467b77 100644 --- a/gatewayd.yaml +++ b/gatewayd.yaml @@ -7,7 +7,7 @@ loggers: # Implementing file output # file : ./logs/gatewayd.log level: "debug" # panic, fatal, error, warn, info, debug, trace - noColor: True + noColor: False timeFormat: "unix" clients: diff --git a/gatewayd_plugins.yaml b/gatewayd_plugins.yaml index 237c9c5b..5002d0e2 100644 --- a/gatewayd_plugins.yaml +++ b/gatewayd_plugins.yaml @@ -9,7 +9,7 @@ plugins: # Plugin name - name: gatewayd-plugin-test # whether to enable or disable the plugin on the next run - enabled: True + enabled: False # path to the plugin's binary file localPath: ../gatewayd-plugin-test/gatewayd-plugin-test # Pass cmdline args to the plugin diff --git a/network/proxy.go b/network/proxy.go index 70153878..1e73a761 100644 --- a/network/proxy.go +++ b/network/proxy.go @@ -427,7 +427,33 @@ func (pr *Proxy) PassThrough(gconn gnet.Conn) *gerr.GatewayDError { // TODO: Implement OnTrafficToClient hooks. // Send the response to the client. - return sendTrafficToClient(response, received) + errVerdict := sendTrafficToClient(response, received) + + // Run the OnTrafficToClient hooks. + _, err = pr.hookConfig.Run( + context.Background(), + trafficData( + gconn, + client, + []Field{ + { + Name: "request", + Value: request, + }, + { + Name: "response", + Value: response[:received], + }, + }, + err, + ), + hook.OnTrafficToClient, + pr.hookConfig.Verification) + if err != nil { + pr.logger.Error().Err(err).Msg("Error running hook") + } + + return errVerdict } // IsHealty checks if the pool is exhausted or the client is disconnected.