 
 (defn ssh-opts 
   "SSH session options" 
-  ([port]
-   {:username "root" :strict-host-key-checking :no :port port})
   ([port user]
    {:username user :strict-host-key-checking :no :port port}))
 
 (defn with-session 
   "Executes f on host with an ssh session"
-  [host port user f]
+  [{:keys [host port user] :or {user "root" port 22}} f]
   (let [agent (ssh-agent  {:use-system-ssh-agent false})]
     (add-identity agent (config :ssh)) 
     (let [session (session agent host (ssh-opts port user))] 

(defn put 
  "Copies a file into host under dest"
  [host file dest]
  (with-session host 22
    (fn [session]
      (let [channel (ssh-sftp session)]
        (with-channel-connection channel

            (when-not (= exit 0) 
              (throw+ (merge res {:type ::execute-failed :exit exit} (meta b))))))
        ))))

(defn fname [uri] (-> uri (split '#"/") last))

