Files
zigp2p/CONTRIBUTING.md
2026-02-06 21:03:59 -03:00

30 KiB

Contributing Guide

Thank you for your interest in contributing to the P2P file sharing library! This guide will help you get started with development, understand our coding standards, and learn how to contribute effectively.

Table of Contents

Getting Started

Prerequisites

Before you start contributing, make sure you have:

  • Zig 0.11.0 or later: The library requires a recent version of Zig
  • Git: For version control
  • Build tools: Compiler toolchain for your platform
  • Development environment: Code editor with Zig support (recommended: VS Code with Zig extension)

Quick Setup

  1. Fork the repository:

    git clone https://github.com/your-username/p2p-library.git
    cd p2p-library
    
  2. Build the project:

    zig build
    
  3. Run tests:

    zig build test
    
  4. Run examples:

    zig build run-server
    zig build run-client
    

Community Guidelines

  • Be respectful: Treat all contributors with respect and courtesy
  • Be constructive: Provide helpful feedback and suggestions
  • Be patient: Help new contributors learn the codebase
  • Be collaborative: Work together to improve the project
  • Be inclusive: Welcome contributors from all backgrounds

Development Setup

Environment Setup

  1. Editor: VS Code with Zig extension
  2. Git hooks: Pre-commit hooks for code quality
  3. Debugging: GDB/LLDB for debugging
  4. Profiling: Valgrind, perf, or platform-specific profilers

Git Configuration

# Set up your identity
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

# Set up line endings (Windows)
git config --global core.autocrlf true

# Set up line endings (Unix/Linux/macOS)
git config --global core.autocrlf input

# Enable useful git aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status

Pre-commit Hooks

Create .git/hooks/pre-commit:

#!/bin/bash
# Run code formatting
zig fmt --check src/

# Run static analysis
zig build analyze 2>/dev/null || true

# Run tests
zig build test

# Check for TODO/FIXME comments
if grep -r "TODO\|FIXME" src/; then
    echo "Found TODO/FIXME comments. Please address before committing."
    exit 1
fi

Make the hook executable:

chmod +x .git/hooks/pre-commit

Build Configuration

The project uses a standard Zig build setup. Key build targets:

# Build all libraries
zig build

# Build specific library
zig build -Dtarget=x86_64-linux-gnu

# Build with optimization
zig build -Doptimize=ReleaseFast

# Build for debugging
zig build -Doptimize=Debug

# Run specific test
zig build test-core
zig build test-network
zig build test-protocol
zig build test-files

# Run examples
zig build run-server
zig build run-client

# Run benchmarks
zig build benchmark

Code Style and Standards

Zig Coding Standards

We follow the official Zig coding standards with some project-specific additions.

Formatting

  • Line length: Maximum 120 characters
  • Indentation: Use tabs, not spaces
  • Braces: Opening brace on same line, closing brace on new line
  • Spacing: Use spaces around operators, after commas, around parentheses
// Good
pub fn exampleFunction(a: i32, b: i32) !i32 {
    const result = a + b;
    
    if (result > 100) {
        return error.ValueTooLarge;
    }
    
    return result;
}

// Bad
pub fn exampleFunction(a:i32,b:i32)!i32{
const result=a+b;
if(result>100){return error.ValueTooLarge;}
return result;}

Naming Conventions

  • Variables and functions: snake_case
  • Types and structs: PascalCase
  • Constants: SCREAMING_SNAKE_CASE
  • Private fields: Prefixed with underscore _private_field
  • Error types: Error.* format
// Good
const MAX_CONNECTIONS = 1000;

pub const ConnectionManager = struct {
    active_connections: u32,
    
    pub fn createConnection(self: *ConnectionManager, address: Address) !Connection {
        // ...
    }
};

pub const Error = error{
    ConnectionTimeout,
    InvalidAddress,
    OutOfMemory,
};

// Bad
const maxConnections = 1000;

pub const connection_manager = struct {
    ActiveConnections: u32,
    
    pub fn CreateConnection(self: *connection_manager, Address: Address) Connection {
        // ...
    }
};

Documentation Standards

Every public function, type, and variable must be documented:

/// Creates a new network connection to the specified address.
/// 
/// This function establishes a TCP connection and initializes
/// the connection state machine. The connection is configured
/// according to the provided configuration parameters.
/// 
/// Args:
///   * `address`: The remote address to connect to
///   * `config`: Connection configuration parameters
///   * `allocator`: Memory allocator for connection resources
/// 
/// Returns:
///   * `Error!Connection`: The created connection or an error
/// 
/// Errors:
///   * `ConnectionTimeout`: Connection attempt timed out
///   * `AddressUnreachable`: Address is not reachable
///   * `OutOfMemory`: Insufficient memory for connection
pub fn connect(address: Address, config: ConnectionConfig, allocator: std.mem.Allocator) !Connection {
    // Implementation
}

Project-Specific Standards

Error Handling

  • Use Zig's error union types (!)
  • Provide meaningful error messages
  • Document all possible errors
  • Use specific error types rather than generic ones
// Good
pub const Error = error{
    NetworkUnreachable,
    ConnectionRefused,
    Timeout,
    InvalidAddress,
};

pub fn connect(address: Address) !Connection {
    if (!address.isValid()) {
        return error.InvalidAddress;
    }
    
    // Implementation
}

// Bad
pub fn connect(address: Address) !Connection {
    if (!address.isValid()) {
        return error.ConnectionFailed;
    }
    
    // Implementation
}

Memory Management

  • Always specify allocators for functions that allocate memory
  • Use defer statements for cleanup
  • Follow RAII principles where applicable
  • Document ownership semantics
// Good
pub fn createBuffer(size: usize, allocator: std.mem.Allocator) !Buffer {
    const buffer = try allocator.alloc(u8, size);
    errdefer allocator.free(buffer);
    
    return Buffer{ .data = buffer, .size = size };
}

// Usage
var buffer = try createBuffer(1024, allocator);
defer allocator.free(buffer.data);

// Bad
pub fn createBuffer(size: usize) Buffer {
    return Buffer{ .data = @as([*]u8, undefined), .size = size };
}

Concurrency Guidelines

  • Use @atomic for thread-safe operations
  • Document which functions are thread-safe
  • Use appropriate memory ordering
  • Prefer lock-free data structures when possible
// Good
pub const AtomicCounter = struct {
    value: std.atomic.Value(u64),
    
    pub fn increment(self: *AtomicCounter) void {
        _ = self.value.fetchAdd(1, .monotonic);
    }
    
    pub fn get(self: *AtomicCounter) u64 {
        return self.value.load(.monotonic);
    }
};

// Usage
var counter = AtomicCounter{ .value = std.atomic.Value(u64).init(0) };
counter.increment(); // Thread-safe

// Bad
pub const Counter = struct {
    value: u64,
    mutex: std.Thread.Mutex,
    
    pub fn increment(self: *Counter) void {
        self.mutex.lock();
        defer self.mutex.unlock();
        self.value += 1;
    }
};

Project Structure

Directory Layout

p2p-library/
├── src/                          # Source code
│   ├── core/                     # Core networking primitives
│   │   ├── address.zig          # Network address handling
│   │   ├── buffer.zig           # Buffer management
│   │   ├── connection.zig       # Connection abstractions
│   │   ├── error.zig            # Error types
│   │   └── socket.zig           # Socket operations
│   ├── network/                  # P2P networking layer
│   │   ├── discovery.zig        # Peer discovery
│   │   ├── node.zig             # Node representation
│   │   ├── routing.zig          # Routing table management
│   │   └── topology.zig         # Network topology
│   ├── protocol/                 # Protocol layer
│   │   ├── handler.zig          # Message handlers
│   │   ├── message.zig          # Message definitions
│   │   ├── router.zig           # Message routing
│   │   └── serializer.zig       # Serialization
│   └── files/                    # File sharing layer
│       ├── download.zig          # File download logic
│       ├── file.zig              # File representation
│       ├── hash.zig              # Cryptographic hashing
│       ├── piece.zig             # File pieces
│       ├── transfer.zig          # Transfer management
│       └── upload.zig            # File upload logic
├── test/                         # Test suite
│   ├── core/                     # Core module tests
│   ├── network/                  # Network module tests
│   ├── protocol/                 # Protocol module tests
│   └── files/                    # Files module tests
├── examples/                     # Example programs
│   ├── server.zig               # Simple server example
│   ├── client.zig               # Simple client example
│   └── protocol_example.zig     # Protocol usage example
├── docs/                         # Documentation
│   ├── library_design.md        # Design documentation
│   └── p2p_research.md          # Research notes
├── benchmark.zig                # Performance benchmarks
├── build.zig                    # Build configuration
├── README.md                    # Main documentation
├── API.md                       # API reference
├── GUIDE.md                     # User guide
├── ARCHITECTURE.md              # Architecture docs
└── CONTRIBUTING.md              # This file

Module Dependencies

Application Layer
       ↓
   ┌─────┐
   │Files│
   └─────┘
       ↓
   ┌─────────┐
   │Protocol │
   └─────────┘
       ↓
   ┌─────────┐
   │ Network │
   └─────────┘
       ↓
   ┌─────────┐
   │ Transport│
   └─────────┘
       ↓
   ┌─────────┐
   │  Core   │
   └─────────┘

Dependency Rules:

  1. Higher layers can depend on lower layers
  2. No circular dependencies between modules
  3. Each module has a clear, single responsibility
  4. Public interfaces are stable, internal interfaces can change

File Naming Conventions

  • Source files: module_name.zig
  • Test files: test_module_name.zig
  • Example files: example_description.zig
  • Benchmark files: benchmark_name.zig

Development Workflow

Branch Strategy

We use a simplified Git Flow strategy:

  • main: Production-ready code
  • develop: Integration branch for features
  • feature/feature-name: Individual feature branches
  • bugfix/bug-description: Bug fix branches
  • hotfix/critical-fix: Critical bug fixes
# Start a new feature
git checkout develop
git pull origin develop
git checkout -b feature/my-new-feature

# Make changes and commit
git add .
git commit -m "feat: add new feature description"

# Push and create pull request
git push origin feature/my-new-feature

Commit Message Format

We follow the Conventional Commits specification:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Types:

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting, etc.)
  • refactor: Code refactoring
  • test: Adding or updating tests
  • chore: Build process or auxiliary tool changes

Examples:

# Good
feat(network): add Kademlia DHT implementation
fix(buffer): handle buffer overflow in edge cases
docs(api): update Connection documentation
refactor(core): simplify Address parsing logic
test(files): add integration tests for file transfers

# Bad
fixed stuff
added new thing
update
working on something

Development Process

  1. Create an issue for the work you want to do
  2. Assign yourself to the issue
  3. Create a branch following the naming convention
  4. Write tests for your changes
  5. Implement the feature following coding standards
  6. Update documentation as needed
  7. Run the test suite to ensure everything works
  8. Create a pull request with a clear description

Testing Guidelines

Test Structure

Every module should have comprehensive tests:

test/
├── test_main.zig              # Main test entry point
├── test_core/                 # Core module tests
│   ├── test_address.zig      # Address tests
│   ├── test_buffer.zig       # Buffer tests
│   ├── test_connection.zig   # Connection tests
│   └── test_error.zig        # Error handling tests
├── test_network/              # Network module tests
│   ├── test_discovery.zig    # Discovery tests
│   ├── test_node.zig         # Node tests
│   └── test_routing.zig      # Routing tests
└── ...

Test Categories

Unit Tests

Test individual functions and components:

const std = @import("std");
const testing = std.testing;

const Address = @import("address.zig").Address;

test "Address.parse - IPv4 address" {
    const addr = try Address.parse("192.168.1.1:8080");
    try testing.expectEqual(Address.Family.ipv4, addr.family);
    try testing.expectEqualStrings("192.168.1.1", addr.ipv4.toString());
    try testing.expectEqual(@as(u16, 8080), addr.port);
}

test "Address.parse - invalid address" {
    const result = Address.parse("invalid");
    try testing.expectError(error.InvalidAddress, result);
}

Integration Tests

Test interactions between components:

test "Connection lifecycle" {
    const allocator = testing.allocator;
    
    // Create connection
    const connection = try Connection.init(.tcp, config, allocator);
    defer connection.deinit();
    
    // Test connection states
    try testing.expectEqual(Connection.State.disconnected, connection.state);
    
    // Connect to mock server
    try connection.connect(test_address);
    try testing.expectEqual(Connection.State.connected, connection.state);
    
    // Close connection
    connection.close();
    try testing.expectEqual(Connection.State.closed, connection.state);
}

Property-Based Tests

Test properties that should hold across many inputs:

test "Buffer operations are symmetric" {
    const allocator = testing.allocator;
    var buffer = try Buffer.init(1024, allocator);
    defer buffer.deinit();
    
    const original_data = "Hello, P2P World!";
    try buffer.write(original_data);
    
    var read_data: [100]u8 = undefined;
    const bytes_read = try buffer.read(&read_data);
    
    try testing.expectEqual(original_data.len, bytes_read);
    try testing.expectEqualStrings(original_data, read_data[0..bytes_read]);
}

Test Coverage

We aim for high test coverage:

  • Core modules: 95%+ coverage
  • Network modules: 90%+ coverage
  • Protocol modules: 85%+ coverage
  • File modules: 90%+ coverage

Run coverage analysis:

# Generate coverage report
zig build test --summary all

# View coverage for specific module
zig build test-core --summary all

Mocking and Test Doubles

Use mocks for testing components in isolation:

pub const MockTransport = struct {
    send_calls: std.ArrayList(SendCall),
    receive_data: std.ArrayList(u8),
    
    const SendCall = struct {
        data: []u8,
        address: Address,
    };
    
    pub fn init(allocator: std.mem.Allocator) MockTransport {
        return MockTransport{
            .send_calls = std.ArrayList(SendCall).init(allocator),
            .receive_data = std.ArrayList(u8).init(allocator),
        };
    }
    
    pub fn send(self: *MockTransport, data: []const u8, address: Address) !usize {
        const call = SendCall{
            .data = try self.allocator.dupe(u8, data),
            .address = address,
        };
        try self.send_calls.append(call);
        return data.len;
    }
    
    pub fn setReceiveData(self: *MockTransport, data: []const u8) !void {
        self.receive_data.clearRetainingCapacity();
        try self.receive_data.appendSlice(data);
    }
};

Documentation Requirements

Code Documentation

Every public API must be documented:

/// Represents a network address for various protocols.
///
/// This struct provides a unified interface for representing
/// network addresses across IPv4, IPv6, Unix domain sockets,
/// and custom protocols. Addresses are immutable after creation
/// and thread-safe for read operations.
///
/// # Examples
///
/// Basic usage:
/// ```zig
/// const addr = try Address.parse("192.168.1.1:8080");
/// const str = try addr.toString();
/// ```
///
/// IPv6 addresses:
/// ```zig
/// const ipv6_addr = try Address.parse("[2001:db8::1]:8080");
/// ```
pub const Address = struct {
    family: Family,
    data: Data,
    
    /// Address families supported by the library
    pub const Family = enum(u8) {
        /// IPv4 address family
        ipv4 = 1,
        /// IPv6 address family
        ipv6 = 2,
        /// Unix domain socket family
        unix = 3,
        /// Custom protocol family
        custom = 4,
    };
    
    /// Parse address from string representation
    ///
    /// Supports the following formats:
    /// - IPv4: "192.168.1.1:8080"
    /// - IPv6: "[2001:db8::1]:8080" or "2001:db8::1:8080"
    /// - Unix: "/path/to/socket"
    ///
    /// Args:
    ///   * `text`: String representation of the address
    ///
    /// Returns:
    ///   * `Error!Address`: Parsed address or error
    ///
    /// Errors:
    ///   * `InvalidAddress`: Address format is not recognized
    ///   * `InvalidPort`: Port number is out of range
    ///   * `AddressTooLong`: Address string exceeds maximum length
    pub fn parse(text: []const u8) Error!Address {
        // Implementation
    }
};

API Documentation

Update API.md when adding or modifying public APIs:

### `module.function_name`

**Purpose**: Brief description of what the function does.

**Parameters**:
- `param1`: Description and type
- `param2`: Description and type

**Returns**: Return type and description

**Errors**: Possible error types and when they occur

**Example**:
```zig
// Usage example showing common patterns

Performance: Performance characteristics if relevant


### User Guide Updates

When adding new features, update the user guide:

- Add tutorial sections for new functionality
- Update existing examples
- Add best practices for new APIs
- Include troubleshooting information

### Architecture Documentation

For significant architectural changes:

- Update system diagrams
- Document new patterns or approaches
- Update performance characteristics
- Add security considerations

## Pull Request Process

### Before Submitting

1. **Run all tests**: Ensure the test suite passes
2. **Update documentation**: Keep docs in sync with code
3. **Check formatting**: Run `zig fmt` on all modified files
4. **Review changes**: Self-review your code for issues
5. **Update changelog**: Add entry to CHANGELOG.md

### PR Template

```markdown
## Description
Brief description of changes made

## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update

## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed

## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] Tests added/updated as needed

## Related Issues
Closes #(issue number)

Review Criteria

Pull requests will be reviewed for:

  1. Code quality: Follows coding standards and best practices
  2. Test coverage: Adequate tests for new functionality
  3. Documentation: Complete and accurate documentation
  4. Performance: No performance regressions
  5. Security: No security vulnerabilities
  6. Compatibility: No breaking changes to public APIs

Review Process

  1. Automated checks: CI pipeline runs tests and linting
  2. Code review: Maintainers review the code
  3. Testing: Manual testing of the changes
  4. Documentation review: Ensure docs are complete and accurate
  5. Final approval: Maintainer approval required

Issue Reporting

Bug Reports

Use the bug report template:

**Describe the bug**
Clear description of the bug

**To Reproduce**
Steps to reproduce the behavior:
1. Run command '...'
2. See error

**Expected behavior**
What you expected to happen

**Environment:**
- OS: [e.g. Ubuntu 20.04]
- Zig version: [e.g. 0.11.0]
- Library version: [e.g. v1.0.0]

**Additional context**
Any other relevant information

Feature Requests

Use the feature request template:

**Is your feature request related to a problem?**
Description of the problem

**Describe the solution you'd like**
Description of the desired solution

**Describe alternatives you've considered**
Alternative solutions considered

**Additional context**
Any other relevant information or use cases

Performance Issues

For performance-related issues:

**Performance Issue Description**
Description of the performance problem

**Expected Performance**
Expected performance characteristics

**Actual Performance**
Actual performance measurements

**Environment:**
- Hardware specifications
- Network conditions
- Workload description

**Reproduction Steps**
Steps to reproduce the performance issue

**Profiling Data**
Include profiling data if available

Code Review Process

Reviewer Guidelines

As a reviewer:

  1. Be constructive: Provide helpful, actionable feedback
  2. Be thorough: Check all aspects of the change
  3. Be timely: Review promptly to keep the process moving
  4. Be respectful: Treat all contributors with respect
  5. Be educational: Help contributors learn and improve

Review Checklist

When reviewing code, check:

Code Quality

  • Code follows style guidelines
  • Functions are appropriately sized and scoped
  • Variable names are clear and descriptive
  • Complex logic is well-commented
  • Error handling is comprehensive

Testing

  • Tests cover the new functionality
  • Tests are readable and maintainable
  • Edge cases are tested
  • Integration tests cover component interactions

Documentation

  • Public APIs are documented
  • Examples are provided where appropriate
  • Documentation is accurate and complete
  • Changelog is updated

Performance

  • No obvious performance issues
  • Memory usage is reasonable
  • Algorithms are appropriate for the use case

Security

  • Input validation is performed
  • No security vulnerabilities introduced
  • Cryptographic operations are correct
  • Authentication and authorization are handled properly

Review Comments

Use constructive comment styles:

**Compliment**: "Great use of the buffer pool here!"

**Suggestion**: "Consider using a more efficient algorithm here. [This](link) paper shows..."

**Question**: "Why did you choose this approach over X?"

**Issue**: "This could cause a buffer overflow. Consider..."

**Praise**: "Excellent error handling in this function!"

Performance Guidelines

Performance Testing

All performance-sensitive code should include benchmarks:

const Benchmark = @import("benchmark.zig");

test "benchmark Buffer operations" {
    const benchmark = try Benchmark.init(testing.allocator);
    defer benchmark.deinit();
    
    const buffer_size = 1024;
    const iterations = 10000;
    
    const time_taken = benchmark.measure("buffer_write", iterations, struct {
        fn run() !void {
            var buffer = try Buffer.create(buffer_size, null);
            defer buffer.deinit();
            
            const data = "x";
            for (0..buffer_size) |_| {
                try buffer.write(data);
            }
        }
    }.run);
    
    std.debug.print("Buffer write: {} ns per operation\n", .{time_taken / iterations});
}

Memory Performance

  • Use memory pools for frequently allocated objects
  • Avoid unnecessary copying of data
  • Profile memory usage regularly
  • Use appropriate data structures for the use case

Network Performance

  • Use appropriate buffer sizes for the network conditions
  • Implement connection pooling for frequently used connections
  • Consider using zero-copy operations where possible
  • Profile network operations regularly

CPU Performance

  • Use appropriate algorithms for the data size
  • Consider cache-friendly data structures
  • Use SIMD operations for bulk data processing where applicable
  • Profile hot paths regularly

Security Guidelines

Security Review

All security-sensitive changes must be reviewed by the security team:

  1. Cryptographic operations: Review all crypto implementations
  2. Input validation: Ensure all inputs are properly validated
  3. Authentication: Review authentication and authorization logic
  4. Network security: Review network-facing code for vulnerabilities
  5. Data handling: Review how sensitive data is handled and stored

Secure Coding Practices

Input Validation

pub fn parseAddress(text: []const u8) !Address {
    // Validate input length
    if (text.len == 0 or text.len > 256) {
        return error.InvalidAddress;
    }
    
    // Check for null bytes (security issue)
    if (std.mem.indexOf(u8, text, "\x00")) |_| {
        return error.InvalidAddress;
    }
    
    // Additional validation...
}

Cryptographic Operations

pub fn encryptData(data: []const u8, key: Key) !EncryptedData {
    // Use authenticated encryption (AEAD)
    var cipher = try Cipher.create(key, .aes256_gcm);
    
    var nonce: [12]u8 = undefined;
    std.crypto.random.bytes(&nonce);
    
    var ciphertext = try allocator.alloc(u8, data.len + 16);
    var tag: [16]u8 = undefined;
    
    try cipher.encrypt(ciphertext[0..data.len], tag, data, &nonce, null);
    @memcpy(ciphertext[data.len..], &tag);
    
    return EncryptedData{ .ciphertext = ciphertext, .nonce = nonce };
}

Secure Memory Handling

pub fn secureClear(data: []u8) void {
    // Use volatile writes to prevent compiler optimization
    @memset(data, 0);
    for (data) |*byte| {
        byte.* = 0;
    }
}

pub fn cleanup() void {
    // Clear sensitive data before freeing
    secureClear(&sensitive_buffer);
    allocator.free(sensitive_buffer);
}

Vulnerability Disclosure

If you discover a security vulnerability:

  1. Do not file a public issue
  2. Email the security team at security@p2p-library.org
  3. Provide detailed information about the vulnerability
  4. Allow time for fixes before public disclosure
  5. Coordinate disclosure with the security team

Release Process

Version Numbering

We follow Semantic Versioning:

  • MAJOR: Breaking changes
  • MINOR: New features (backward compatible)
  • PATCH: Bug fixes (backward compatible)

Release Checklist

Before each release:

  1. Update version numbers in build.zig
  2. Update CHANGELOG.md
  3. Update README.md with new version info
  4. Run full test suite
  5. Update documentation
  6. Create release branch
  7. Tag the release
  8. Build release artifacts
  9. Create GitHub release
  10. Update website/documentation
  11. Announce release

Release Automation

Automated release process using GitHub Actions:

# .github/workflows/release.yml
name: Release
on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '18'
      
      - name: Setup Zig
        uses: koffeinfrei/zig-setup@v1
        with:
          zig-version: 0.11.0
      
      - name: Build release
        run: |
          zig build -Doptimize=ReleaseFast
          zig build -Dtarget=aarch64-linux-gnu
          zig build -Dtarget=x86_64-windows-gnu
      
      - name: Create release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: ${{ steps.changelog.outputs.content }}

Changelog Format

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- New features

### Changed
- Changes in existing functionality

### Deprecated
- Features that will be removed

### Removed
- Removed features

### Fixed
- Bug fixes

### Security
- Security improvements

## [1.0.0] - 2024-01-01

### Added
- Initial release of P2P library
- Core networking functionality
- File sharing capabilities

Thank you for contributing to the P2P file sharing library! Your contributions help make this project better for everyone. If you have questions about contributing, please reach out to the maintainers or open an issue.

For more information: