forked from Hithomelabs/CFTunnels
Hithomelabs/CFTunnels#114: Add JavaDoc to Mapping entity
This commit is contained in:
parent
6bf138ea7a
commit
e8d535efda
@ -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;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user