public PortKnockResponse DoGet(PortKnockRequest req)
 {
     return(new PortKnockResponse()
     {
         Result = "NG",
         Message = "unknown method"
     });
 }
        public PortKnockResponse DoPost(PortKnockRequest req)
        {
            // need to log here.

            if (req.Action.ToLower() == "allow")
            {
                try
                {
                    FirewallUtils.AllowAddressPort(req.Ip, req.Port);
                    return(new PortKnockResponse()
                    {
                        Result = "OK",
                        Message = null
                    });
                }
                catch (Exception e)
                {
                    return(new PortKnockResponse()
                    {
                        Result = "NG",
                        Message = e.Message
                    });
                }
            }
            else if (req.Action.ToLower() == "deny")
            {
                try
                {
                    FirewallUtils.CloseAddressPort(req.Ip, req.Port);
                    return(new PortKnockResponse()
                    {
                        Result = "OK",
                        Message = null
                    });
                }
                catch (Exception e)
                {
                    return(new PortKnockResponse()
                    {
                        Result = "NG",
                        Message = e.Message
                    });
                }
            }

            return(new PortKnockResponse()
            {
                Result = "NG",
                Message = "unknown error"
            });
        }