123456789101112131415161718192021222324open!Coreopen!Importletssh_client_var="SSH_CLIENT"letparse_ssh_client_var=function|None->Ok`Nowhere|Somes->(matchString.split~on:' 'swith|[]->failwith"This should never happen, empty string splits as [\"\"]"(* Allow any SSH_CLIENT var containing an IP address as the first element.
Normally, it should have three parts, but relaxing this constraint helps
debugging/troubleshooting easier. *)|address::_->Or_error.try_with(fun()->`From(Unix.Inet_addr.of_stringaddress))|>fune->Or_error.tag_arge"Could not parse IP address in SSH_CLIENT"s[%sexp_of:string]);;letparse_ssh_client()=parse_ssh_client_var(Sys.getenvssh_client_var)modulePrivate=structletparse_ssh_client_var=parse_ssh_client_varend