dummy impl lmao lol funny commit message xD

This commit is contained in:
lilly 2026-05-20 08:51:12 +02:00
commit 8b7407ba26
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g
7 changed files with 221 additions and 13 deletions

View file

@ -1,18 +1,27 @@
defmodule P2pChat do
@moduledoc """
Documentation for `P2pChat`.
"""
@doc """
Hello world.
## Examples
iex> P2pChat.hello()
:world
"""
def hello do
:world
{:ok, pid1} = P2pChat.Transport.start_link(port: 12345)
netid1 = P2pChat.Transport.get_netid(pid1)
{:ok, pid2} = P2pChat.Transport.start_link(port: 12346)
netid2 = P2pChat.Transport.get_netid(pid2)
# {:ok, addr4} = :inet.parse_address ~c"2600::"
# {:ok, addr6} = :inet.parse_address ~c"9.9.9.9"
{:ok, addr6} = :inet.parse_address ~c"::"
{:ok, addr4} = :inet.parse_address ~c"127.0.0.1"
P2pChat.Transport.add_neighbor(pid1, netid2, {addr4, 12346})
P2pChat.Transport.add_neighbor(pid1, netid2, {addr6, 12346})
Process.sleep(500)
P2pChat.Transport.inform_about_self(pid1)
Process.sleep(500)
neighbors2 = P2pChat.Transport.get_neighbors(pid2)
IO.inspect(neighbors2)
GenServer.stop(pid1)
GenServer.stop(pid2)
end
end