Skip to content

Commit

Permalink
this was mostly generated by cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdeliso committed Jan 22, 2025
1 parent 1906c6d commit dd166e3
Show file tree
Hide file tree
Showing 46 changed files with 3,670 additions and 374 deletions.
135 changes: 135 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Teflon

Teflon is a peer-to-peer desktop chat application built using Java Swing. The project serves two main purposes:

1. Providing a functional, decentralized chat platform
2. Serving as a test bed for evaluating different AI-assisted development approaches

## Project Overview

This project is being actively developed using various AI coding assistants to evaluate their effectiveness in real-world software development. The development process helps assess:

- Code quality and consistency
- Testing coverage and reliability
- Documentation clarity
- Bug detection and resolution
- Refactoring capabilities

## Technical Architecture

### Core Components

1. **User Interface (UI)**
- Built with Java Swing for a native desktop experience
- Features a modern, HTML-rendered chat display
- Supports system events, message acknowledgments, and status updates
- Includes connection management and configuration dialogs

2. **Networking**
- Uses UDP multicast for peer-to-peer communication
- Supports both IPv4 and IPv6 multicast groups
- Implements reliable message delivery with acknowledgments
- Provides network interface selection for flexible deployment

3. **Message Handling**
- Unique message IDs for tracking and acknowledgment
- Support for different message types (chat, ACK, NACK, system events)
- Message validation and checksum verification
- HTML-safe message rendering with color coding

### Key Features

- **Decentralized Communication**: No central server required
- **Network Discovery**: Automatic peer discovery via multicast
- **Message Reliability**: Acknowledgment system for message delivery confirmation
- **Command System**: Built-in commands for status and help
- **Connection Management**: Interface selection and connection status monitoring
- **Visual Feedback**: Color-coded status indicators and message formatting

## Usage

### Requirements

- Java 21 or higher
- Maven for building

### Building

```bash
./mvnw clean package
```

### Running

```bash
java -jar target/teflon-1.2.0-jar-with-dependencies.jar
```

### Available Commands

- `/help` - Display available commands
- `/status` - Show connection status and message statistics

### Network Configuration

#### Multicast Groups

- IPv6: Uses Link-Local Scope Multicast Addresses (FF02::/16)
- IPv4: Supports Class D addresses (224.0.0.0 - 239.255.255.255)
- Custom multicast addresses can be configured

#### Network Interfaces

- Automatic detection of available network interfaces
- Support for both wired and wireless connections
- Interface selection through configuration dialog

## Development

### Testing

The project includes comprehensive test coverage:

```bash
./mvnw test
```

### Code Style

Follows standard Java conventions, enforced by Checkstyle:

```bash
./mvnw checkstyle:check
```

### Code Coverage

JaCoCo is used for code coverage analysis:

```bash
./mvnw jacoco:report
```

## References

### Networking

- [IPv6 Multicast Addresses](https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml)
- [Link-local Addresses](https://en.wikipedia.org/wiki/Link-local_address#IPv6)
- [RFC 3171 - IPv4 Multicast Guidelines](https://www.rfc-editor.org/rfc/rfc3171)

### UI Framework

- [Java Swing Documentation](https://docs.oracle.com/javase/tutorial/uiswing/)

## Version History

### 1.3.0

- Enhanced status command with HTML formatting
- Improved message display and formatting
- Refactored common code for better maintainability
- Enhanced test coverage and reliability
- Basic chat functionality
- Network interface selection
- Message acknowledgment system
21 changes: 0 additions & 21 deletions Readme.md

This file was deleted.

44 changes: 44 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<property name="severity" value="error"/>
<property name="fileExtensions" value="java"/>

<!-- Checks whether files end with a new line -->
<module name="NewlineAtEndOfFile"/>

<!-- Allow longer lines -->
<module name="LineLength">
<property name="max" value="120"/>
</module>

<module name="TreeWalker">
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>

<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 1, 2, 3, 4, 5, 8, 10, 16, 32, 64, 100, 128, 256, 512, 1024"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<module name="FinalClass"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>

<!-- Miscellaneous other checks -->
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
</module>
</module>
126 changes: 120 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@

<groupId>name.maxdeliso</groupId>
<artifactId>teflon</artifactId>
<version>1.1.0</version>
<version>1.3.0</version>
<packaging>jar</packaging>
<name>teflon</name>
<url>https://github.com/maxdeliso/teflon</url>

<properties>
<java.version>21</java.version>
<java.target>21</java.target>
<release.version>21</release.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.target}</maven.compiler.target>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<argLine>-Xmx1024m</argLine>
<junit.jupiter.execution.timeout.default>10s</junit.jupiter.execution.timeout.default>
<junit.jupiter.execution.timeout.mode>enabled</junit.jupiter.execution.timeout.mode>
</properties>

<dependencies>
Expand All @@ -24,6 +26,12 @@
<version>2.10.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand All @@ -39,16 +47,44 @@
<artifactId>commons-text</artifactId>
<version>1.13.0</version>
</dependency>

<!-- Testing Dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.12.1</version>
<configuration>
<release>${java.version}</release>
<release>21</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<mainClass>name.maxdeliso.teflon.Main</mainClass>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -106,6 +142,84 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.12.7</version>
</dependency>
</dependencies>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<excludes>module-info.java</excludes>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<argLine>@{argLine} -Dnet.bytebuddy.experimental=true -XX:+EnableDynamicAgentLoading --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</argLine>
<runOrder>random</runOrder>
<rerunFailingTestsCount>0</rerunFailingTestsCount>
<properties>
<configurationParameters>
junit.jupiter.execution.timeout.default = 10s
junit.jupiter.execution.timeout.mode = enabled
</configurationParameters>
</properties>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-wrapper-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<mavenVersion>3.9.6</mavenVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit dd166e3

Please sign in to comment.