public ActionResult <bool> Connect(PeerConnectRequest request)
        {
            if (_requiredConnection == null)
            {
                return(NotFound($"Cannot produce output because {nameof(NetworkRequiredConnection)} is not available"));
            }

            if (!LightningEndpoint.TryParse(request.EndPoint, out LightningEndpoint ipEndPoint))
            {
                return(BadRequest("Incorrect endpoint"));
            }

            return(Ok(_requiredConnection.TryAddLightningEndPoint(ipEndPoint)));
        }
예제 #2
0
        public bool TryGetEndPoint([MaybeNullWhen(false)] out LightningEndpoint?endPoint)
        {
            endPoint = null;

            if (LightningEndPoint == null)
            {
                return(false);
            }

            if (!LightningEndpoint.TryParse(LightningEndPoint, out endPoint))
            {
                return(false);
            }

            return(true);
        }