[ISSUE-114] Add comprehensive JavaDoc and documentation to CFTunnels #115

Merged
hitanshu merged 14 commits from Dave/CFTunnels:ISSUE-114 into main 2026-04-18 13:28:28 +00:00
Showing only changes of commit e8d535efda - Show all commits

View File

@ -6,9 +6,29 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import java.util.UUID; import java.util.UUID;
/**
* JPA Entity representing an ingress mapping configuration for a Cloudflare Tunnel.
*
* <p>A mapping defines how incoming traffic should be routed through the tunnel
* to your internal services. It specifies the protocol, port, and subdomain
* where the service will be accessible.</p>
*
* <p>Database Table: {@code mappings}</p>
*
* <p><b>Example Usage:</b></p>
* <pre>
* Mapping mapping = new Mapping();
* mapping.setPort(8080);
* mapping.setProtocol(Protocol.HTTP);
* mapping.setSubdomain("api");
* </pre>
*
* @see Tunnel
* @see Protocol
* @see Request
*/
@Entity @Entity
@Getter @Getter
@Setter @Setter
@ -17,22 +37,50 @@ import java.util.UUID;
@Table(name = "mappings") @Table(name = "mappings")
public class Mapping { public class Mapping {
/**
* Unique identifier for this mapping (auto-generated UUID).
*/
@Id @Id
@GeneratedValue @GeneratedValue
@Column(columnDefinition = "uuid", nullable = false, unique = true) @Column(columnDefinition = "uuid", nullable = false, unique = true)
private UUID id; private UUID id;
/**
* Port number where the internal service is running.
*
* <p>Example: 8080 for a Spring Boot application's default port.</p>
*/
@Column(nullable = false) @Column(nullable = false)
private int port; private int port;
/**
* Protocol used for the connection.
*
* <p>Supported values: HTTP, HTTPS, TCP, SSH</p>
* @see Protocol
*/
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
@Column(length = 10, nullable = false) @Column(length = 10, nullable = false)
private Protocol protocol; private Protocol protocol;
/**
* Subdomain prefix for accessing this service.
*
* <p>Example: "api" would make the service available at
* {@code api.yourdomain.com}</p>
*/
@Column(length = 50, nullable = false) @Column(length = 50, nullable = false)
private String subdomain; private String subdomain;
/**
* The tunnel this mapping is associated with.
*
* <p>Each mapping belongs to exactly one tunnel.
* This is a lazy-loaded relationship to optimize performance.</p>
*
* @see Tunnel
*/
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "tunnel_id", nullable = false) @JoinColumn(name = "tunnel_id", nullable = false)
private Tunnel tunnel; private Tunnel tunnel;
} }