summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-06-11 20:53:15 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2024-06-11 20:53:15 +0200
commit64243ab0f18e726f57afe93c7d440386a819cdac (patch)
tree34bc19219450ed1bf7373d782ea2fc606ca5ea42 /main
parent506ac77c2288696413baab4a44c3c2de93995c82 (diff)
Command to add public peers
Diffstat (limited to 'main')
-rw-r--r--main/Main.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/main/Main.hs b/main/Main.hs
index f52e22a..0eb414c 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -418,6 +418,7 @@ commands =
[ ("history", cmdHistory)
, ("peers", cmdPeers)
, ("peer-add", cmdPeerAdd)
+ , ("peer-add-public", cmdPeerAddPublic)
, ("peer-drop", cmdPeerDrop)
, ("send", cmdSend)
, ("update-identity", cmdUpdateIdentity)
@@ -472,6 +473,12 @@ cmdPeerAdd = void $ do
addr:_ <- liftIO $ getAddrInfo (Just $ defaultHints { addrSocketType = Datagram }) (Just hostname) (Just port)
liftIO $ serverPeer server (addrAddress addr)
+cmdPeerAddPublic :: Command
+cmdPeerAddPublic = do
+ server <- asks ciServer
+ addr:_ <- liftIO $ getAddrInfo (Just $ defaultHints { addrSocketType = Datagram }) (Just "discovery1.erebosprotocol.net") (Just (show discoveryPort))
+ void $ liftIO $ serverPeer server (addrAddress addr)
+
cmdPeerDrop :: Command
cmdPeerDrop = do
dropPeer =<< getSelectedPeer