Skip to main content

msg:reception_peer

Last updated March 2020

Name

msg:reception_peer — Get the recv_from IP and/or PORT.

Synopsis

require('msys.extended.message')

msg:reception_peer(flag);

flag: string (optional)

Description

This function returns the IP and/or PORT of the remote injection source. In particular, it returns the component of the sockaddr, in human-readable form, as indicated by the flag. The value of the flag parameter can be ip, port or all. The default input parameter is all. That is, if flag is nil, then this returns the same string as if all was passed as the parameter.

require("msys.extended.message");

local mod = {};

function mod:validate_data(msg, ac, vctx)
  print(msg:reception_peer('ip'));
    -- "10.1.2.3"
  print(msg:reception_peer('port'));
      -- "25"
  print(msg:reception_peer('all'));
      -- "10.1.2.3:25"
  print(msg:reception_peer()); -- defaults to 'all'
      -- "10.1.2.3:25"
  return msys.core.VALIDATE_CONT;
end

msys.registerModule("myMod", mod);

See Also

Was this page helpful?