From 9cdfb6eb9cd30c4e06a7d9fef53e519983827d81 Mon Sep 17 00:00:00 2001 From: Simponic Date: Mon, 19 Dec 2022 01:37:10 -0700 Subject: Initial commit! --- lib/chessh/application.ex | 9 +++++++++ lib/chessh/shell.ex | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 lib/chessh/application.ex create mode 100644 lib/chessh/shell.ex (limited to 'lib/chessh') diff --git a/lib/chessh/application.ex b/lib/chessh/application.ex new file mode 100644 index 0000000..c760532 --- /dev/null +++ b/lib/chessh/application.ex @@ -0,0 +1,9 @@ +defmodule Chessh.Application do + use Application + + def start(_, _) do + children = [Chessh.Repo] + opts = [strategy: :one_for_one, name: Chessh.Supervisor] + Supervisor.start_link(children, opts) + end +end diff --git a/lib/chessh/shell.ex b/lib/chessh/shell.ex new file mode 100644 index 0000000..f9f475d --- /dev/null +++ b/lib/chessh/shell.ex @@ -0,0 +1,18 @@ +defmodule Chessh.Shell do + use Sshd.ShellHandler + + def on_shell(_username, _public_key, _ip, _port) do + :ok = + IO.puts( + "Interactive example SSH shell - type exit ENTER to quit and it is running on #{inspect(self())}" + ) + end + + def on_connect(_username, _ip, _port, _method) do + Logger.debug("Connection established") + end + + def on_disconnect(_username, _ip, _port) do + Logger.debug("Connection disestablished") + end +end -- cgit v1.2.3-70-g09d2