-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notify telegram in case of sync errors Run tests weekly
- Loading branch information
Showing
21 changed files
with
220 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.gradle | ||
build | ||
out | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Container with application | ||
FROM bellsoft/liberica-openjre-alpine:21.0.3 | ||
FROM bellsoft/liberica-openjre-alpine:21.0.5 | ||
RUN apk --no-cache add curl | ||
COPY /build/install/ddns /ddns | ||
ENTRYPOINT /ddns/bin/ddns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,37 @@ | ||
plugins { | ||
application | ||
kotlin("jvm").version("2.0.0-RC3") | ||
kotlin("plugin.serialization").version("2.0.0-RC3") | ||
kotlin("jvm").version("2.0.21") | ||
kotlin("plugin.serialization").version("2.0.21") | ||
} | ||
|
||
application { | ||
mainClass.set("io.heapy.ddns.Application") | ||
applicationName = "ddns" | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(21) | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.11") | ||
implementation("io.ktor:ktor-serialization-kotlinx-json:3.0.1") | ||
|
||
implementation("io.ktor:ktor-client-cio:3.0.1") | ||
implementation("io.ktor:ktor-client-content-negotiation:3.0.1") | ||
|
||
implementation("io.ktor:ktor-client-cio:2.3.11") | ||
implementation("io.ktor:ktor-client-content-negotiation:2.3.11") | ||
implementation("io.ktor:ktor-server-cio:3.0.1") | ||
implementation("io.ktor:ktor-server-content-negotiation:3.0.1") | ||
implementation("io.ktor:ktor-server-call-logging:3.0.1") | ||
|
||
implementation("io.ktor:ktor-server-cio:2.3.11") | ||
implementation("io.ktor:ktor-server-content-negotiation:2.3.11") | ||
implementation("io.ktor:ktor-server-call-logging:2.3.11") | ||
implementation("ch.qos.logback:logback-classic:1.5.12") | ||
|
||
implementation("ch.qos.logback:logback-classic:1.5.6") | ||
implementation("io.heapy.komok:komok-tech-dotenv:1.0.7") | ||
|
||
testImplementation("io.ktor:ktor-server-tests:2.3.11") | ||
testImplementation("io.ktor:ktor-server-test-host:3.0.1") | ||
|
||
testImplementation(kotlin("test-junit")) | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,5 +45,4 @@ class CloudflareVerifyToken( | |
val type: String? = null, | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.heapy.ddns.server | ||
|
||
data class ServerConfiguration( | ||
val port: Int, | ||
val host: String, | ||
val header: String?, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.heapy.ddns.server | ||
|
||
import io.ktor.server.cio.CIO | ||
import io.ktor.server.engine.embeddedServer | ||
|
||
/** | ||
* DDNS Server: Returning request source ip in response | ||
*/ | ||
open class ServerFactory( | ||
open val config: Map<String, String>, | ||
) { | ||
open val server by lazy { | ||
embeddedServer( | ||
factory = CIO, | ||
port = serverConfiguration.port, | ||
host = serverConfiguration.host, | ||
) { | ||
with(serverModule) { | ||
install() | ||
} | ||
} | ||
} | ||
|
||
open val serverModule by lazy { | ||
ServerModule( | ||
serverConfiguration = serverConfiguration, | ||
) | ||
} | ||
|
||
open val serverConfiguration by lazy { | ||
ServerConfiguration( | ||
port = config["PORT"]?.toInt() ?: 8080, | ||
host = config["HOST"] ?: "0.0.0.0", | ||
header = config["HEADER"], | ||
) | ||
} | ||
|
||
open fun start() { | ||
server.start(wait = true) | ||
} | ||
} |
Oops, something went wrong.