[ISSUE-114] Add comprehensive JavaDoc and documentation to CFTunnels #115
@ -6,9 +6,29 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
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
|
||||
@Getter
|
||||
@Setter
|
||||
@ -17,21 +37,49 @@ import java.util.UUID;
|
||||
@Table(name = "mappings")
|
||||
public class Mapping {
|
||||
|
||||
/**
|
||||
* Unique identifier for this mapping (auto-generated UUID).
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(columnDefinition = "uuid", nullable = false, unique = true)
|
||||
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)
|
||||
private int port;
|
||||
|
||||
/**
|
||||
* Protocol used for the connection.
|
||||
*
|
||||
* <p>Supported values: HTTP, HTTPS, TCP, SSH</p>
|
||||
* @see Protocol
|
||||
*/
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(length = 10, nullable = false)
|
||||
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)
|
||||
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)
|
||||
@JoinColumn(name = "tunnel_id", nullable = false)
|
||||
private Tunnel tunnel;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user