work on palmdef

This commit is contained in:
c0repwn3r 2023-03-14 23:58:29 -04:00
commit 5ee02573e1
Signed by: core
GPG Key ID: FDBF740DADDCEECF
10 changed files with 114 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/palm.iml" filepath="$PROJECT_DIR$/.idea/palm.iml" />
</modules>
</component>
</project>

11
.idea/palm.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

7
Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "palm"
version = "0.1.0"

8
Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "palm"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

56
palmdef/palmdef.proto Normal file
View File

@ -0,0 +1,56 @@
syntax = "proto3";
/*
There are four types of messages that palm can send.
1. Unencrypted reflection. This is unencrypted communication between a relay and a client.
2. Encrypted reflection. This is encrypted communication between a relay and a client.
3. Unencrypted tunnel. This is unencrypted communication between a client and a client, through a relay. Note that it is encrypted both ways via encrypted reflection.
4. Encrypted tunnel. This is doubly-encrypted communcation between a client and a client, through a relay.
The following convention is used:
C2R Client to Relay - Reflection
R2C Relay to Client - Reflection
I2R Initiating Client to Receiving Client - Tunneled
R2I Receiving Client to Initiating Client - Tunneled
*/
/////// UNENCRYPTED REFLECTION ///////
// Sent by client at start of connection
message PalmC2RHandshakeStart {
bytes ClientPublicKey = 1; // 32-byte X25519 public key
bytes SessionIV = 2; // 12-byte randomized IV generated by the client
bytes Check = 3; // 32-byte randomized value used to check encryption
}
// Sent by relay in response to PalmC2RHandshakeStart
message PalmR2CHandshakeFinish {
bytes ServerPublicKey = 1; // 32-byte X25519 public key
bytes Check = 2; // The same 32-byte value provided in PalmC2SHandshakeStart, used to tie this response to the original session
}
/////// ENCRYPTED REFLECTED MESSAGES ///////
// Sent by client after receiving PalmR2CHandshakeFinish.
// Used by the client to request a room on the server.
message PalmC2RRelayRequest {
bytes Check = 1; // The same 32-byte value used in initial reflected handshake, ties this to the session.
string ChannelID = 2; // The string channel ID this client is requested to be routed to.
}
// Represents the states a room/channel can be in.
enum PalmRoomStatus {
NotReady = 0; // Waiting for a peer to join
Ready = 1; // A peer has joined, and the relay is ready to relay the connection
InUse = 2; // This channel is already in use and cannot be used currently
}
// Send at *any time* by the server to indicate the current status of the server.
// Must also be sent in response to PalmC2RRelayRequest to indicate the current status of the room.
// If the other peer is disconnected, PalmR2CChannelStatus will be sent again with Status = NotReady;
// The client must handle this correctly.
message PalmR2CChannelStatus {
bytes Check = 1; // The same 32-byte value used in previous packets, ties this packet to the session.
string ChannelID = 2; // The channel that the client requested.
PalmRoomStatus Status = 3; // The current status of the room.
}

3
src/main.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}