This commit is contained in:
Sudo-Ivan
2024-12-31 15:30:39 -06:00
parent 12156adae9
commit 8df4039b18
3 changed files with 61 additions and 30 deletions

9
LICENSE Normal file
View File

@@ -0,0 +1,9 @@
Copyright 2024 Sudo-Ivan / Quad4.io
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -36,13 +36,13 @@ Packages:
- [x] Cryptographic Primitives (Testing required)
- [x] Ed25519
- [x] Curve25519
- [x] AES-GCM
- [x] AES-CBC
- [x] SHA-256
- [x] HKDF
- [x] Secure random number generation
- [x] HMAC
- [x] Packet Handling (In Progress)
- [ ] Packet Handling (In Progress)
- [x] Packet creation
- [x] Packet validation
- [x] Basic proof system
@@ -60,6 +60,28 @@ Packages:
- [ ] Testing announce from go client to python client
- [ ] Testing path finding and caching
- [ ] Buffer System (In Progress)
- [ ] Raw channel reader/writer
- [ ] Buffered stream implementation
- [ ] Compression support
- [ ] Testing with Channel system
- [ ] Cross-client compatibility testing
- [ ] Channel System (Not Started)
- [ ] Channel creation and management
- [ ] Message handling
- [ ] Channel encryption
- [ ] Channel authentication
- [ ] Channel callbacks
- [ ] Integration with Buffer system
- [ ] Resolver System (Not Started)
- [ ] Name resolution
- [ ] Cache management
- [ ] Announce handling
- [ ] Path resolution
- [ ] Integration with Transport layer
### Interface Implementation (In Progress)
- [x] UDP Interface
- [x] TCP Interface

View File

@@ -44,34 +44,34 @@ type RequestHandler struct {
}
type Destination struct {
identity *identity.Identity
direction byte
destType byte
appName string
aspects []string
hash []byte
acceptsLinks bool
proofStrategy byte
packetCallback PacketCallback
proofCallback ProofRequestedCallback
linkCallback LinkEstablishedCallback
identity *identity.Identity
direction byte
destType byte
appName string
aspects []string
hash []byte
acceptsLinks bool
proofStrategy byte
packetCallback PacketCallback
proofCallback ProofRequestedCallback
linkCallback LinkEstablishedCallback
ratchetsEnabled bool
ratchetPath string
ratchetCount int
ratchetInterval int
enforceRatchets bool
defaultAppData []byte
defaultAppData []byte
mutex sync.RWMutex
requestHandlers map[string]*RequestHandler
callbacks struct {
packetReceived common.PacketCallback
proofRequested common.ProofRequestedCallback
linkEstablished common.LinkEstablishedCallback
callbacks struct {
packetReceived common.PacketCallback
proofRequested common.ProofRequestedCallback
linkEstablished common.LinkEstablishedCallback
}
}
@@ -95,17 +95,17 @@ func New(id *identity.Identity, direction byte, destType byte, appName string, a
// Generate destination hash
d.hash = d.Hash()
return d, nil
}
func (d *Destination) Hash() []byte {
nameHash := sha256.Sum256([]byte(d.ExpandName()))
identityHash := sha256.Sum256(d.identity.GetPublicKey())
combined := append(nameHash[:], identityHash[:]...)
finalHash := sha256.Sum256(combined)
return finalHash[:16] // Truncated to 128 bits
}
@@ -220,7 +220,7 @@ func (d *Destination) SetProofStrategy(strategy byte) {
func (d *Destination) EnableRatchets(path string) bool {
d.mutex.Lock()
defer d.mutex.Unlock()
d.ratchetsEnabled = true
d.ratchetPath = path
return true
@@ -236,7 +236,7 @@ func (d *Destination) SetRetainedRatchets(count int) bool {
if count < 1 {
return false
}
d.mutex.Lock()
defer d.mutex.Unlock()
d.ratchetCount = count
@@ -247,7 +247,7 @@ func (d *Destination) SetRatchetInterval(interval int) bool {
if interval < 1 {
return false
}
d.mutex.Lock()
defer d.mutex.Unlock()
d.ratchetInterval = interval
@@ -340,7 +340,7 @@ func (d *Destination) Decrypt(ciphertext []byte) ([]byte, error) {
// Create empty ratchet receiver to get latest ratchet ID if available
ratchetReceiver := &common.RatchetIDReceiver{}
// Call Decrypt with full parameter list:
// - ciphertext: the encrypted data
// - ratchets: nil since we're not providing specific ratchets
@@ -366,4 +366,4 @@ func (d *Destination) GetPublicKey() []byte {
func (d *Destination) GetIdentity() *identity.Identity {
return d.identity
}
}