forked from woggioni/rbcs
Compare commits
1
Commits
dev
..
86a5fba7f4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86a5fba7f4 |
@@ -4,6 +4,8 @@
|
|||||||
# Ignore Gradle build output directory
|
# Ignore Gradle build output directory
|
||||||
build
|
build
|
||||||
|
|
||||||
|
rbcs-cli/native-image/*.json
|
||||||
|
|
||||||
# Ignore JDTLS files
|
# Ignore JDTLS files
|
||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
FROM eclipse-temurin:25-jre-alpine AS base-release
|
FROM eclipse-temurin:25-jre-alpine AS base-release
|
||||||
RUN adduser -D rbcs
|
RUN adduser -D rbcs
|
||||||
USER rbcs
|
USER rbcs
|
||||||
ENV RBCS_CONFIGURATION_DIR="/etc/rbcs"
|
|
||||||
WORKDIR /var/lib/rbcs
|
WORKDIR /var/lib/rbcs
|
||||||
|
|
||||||
FROM base-release AS release-vanilla
|
FROM base-release AS release-vanilla
|
||||||
@@ -48,12 +47,9 @@ FROM scratch AS release-native
|
|||||||
COPY --from=base-native /etc/passwd /etc/passwd
|
COPY --from=base-native /etc/passwd /etc/passwd
|
||||||
COPY --from=base-native /etc/rbcs /etc/rbcs
|
COPY --from=base-native /etc/rbcs /etc/rbcs
|
||||||
COPY --from=base-native /var/lib/rbcs /var/lib/rbcs
|
COPY --from=base-native /var/lib/rbcs /var/lib/rbcs
|
||||||
COPY --from=base-native /var/tmp/rbcs /var/tmp/rbcs
|
|
||||||
ADD rbcs-cli.upx /usr/bin/rbcs-cli
|
ADD rbcs-cli.upx /usr/bin/rbcs-cli
|
||||||
ADD logback.xml /etc/rbcs/logback.xml
|
|
||||||
USER rbcs
|
USER rbcs
|
||||||
WORKDIR /var/lib/rbcs
|
WORKDIR /var/lib/rbcs
|
||||||
ENV RBCS_CONFIGURATION_DIR="/etc/rbcs"
|
|
||||||
ENTRYPOINT ["/usr/bin/rbcs-cli", "-XX:MaximumHeapSizePercent=70", "-Dio.netty.tmpdir=/var/tmp/rbcs", "-Dlogback.configurationFile=/etc/rbcs/logback.xml"]
|
ENTRYPOINT ["/usr/bin/rbcs-cli", "-XX:MaximumHeapSizePercent=70", "-Dio.netty.tmpdir=/var/tmp/rbcs", "-Dlogback.configurationFile=/etc/rbcs/logback.xml"]
|
||||||
|
|
||||||
FROM debian:12-slim AS release-jlink
|
FROM debian:12-slim AS release-jlink
|
||||||
@@ -65,5 +61,4 @@ RUN adduser -u 1000 rbcs
|
|||||||
USER rbcs
|
USER rbcs
|
||||||
WORKDIR /var/lib/rbcs
|
WORKDIR /var/lib/rbcs
|
||||||
ADD logback.xml /etc/rbcs/logback.xml
|
ADD logback.xml /etc/rbcs/logback.xml
|
||||||
ENV RBCS_CONFIGURATION_DIR="/etc/rbcs"
|
|
||||||
ENTRYPOINT ["/usr/local/bin/rbcs-cli"]
|
ENTRYPOINT ["/usr/local/bin/rbcs-cli"]
|
||||||
|
|||||||
+2
-2
@@ -2,9 +2,9 @@ org.gradle.configuration-cache=false
|
|||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
|
|
||||||
rbcs.version = 0.5.1
|
rbcs.version = 0.5.0
|
||||||
|
|
||||||
lys.version = 2026.06.08
|
lys.version = 2026.05.16
|
||||||
|
|
||||||
gitea.maven.url = https://gitea.woggioni.net/api/packages/woggioni/maven
|
gitea.maven.url = https://gitea.woggioni.net/api/packages/woggioni/maven
|
||||||
docker.registry.url=gitea.woggioni.net
|
docker.registry.url=gitea.woggioni.net
|
||||||
|
|||||||
+1
-4
@@ -2,12 +2,9 @@ package net.woggioni.rbcs.api;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public interface SpanHandle {
|
public interface RedisSpan {
|
||||||
|
|
||||||
void setAttribute(@NotNull String key, @NotNull String value);
|
void setAttribute(@NotNull String key, @NotNull String value);
|
||||||
|
|
||||||
void setAttribute(@NotNull String key, long value);
|
void setAttribute(@NotNull String key, long value);
|
||||||
|
|
||||||
void setAttribute(@NotNull String key, boolean value);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,15 +4,13 @@ import io.netty.channel.ChannelHandler;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface TelemetryController {
|
public interface TelemetryController {
|
||||||
void initialize();
|
void initialize();
|
||||||
@NotNull ChannelHandler createHandler();
|
@NotNull ChannelHandler createHandler();
|
||||||
|
|
||||||
@Nullable SpanHandle startSpan(@NotNull String command);
|
@Nullable RedisSpan startRedisSpan(@NotNull String command, @NotNull String key);
|
||||||
|
|
||||||
void endSpan(@Nullable SpanHandle span);
|
void endRedisSpan(@Nullable RedisSpan span);
|
||||||
|
|
||||||
void endSpan(@Nullable SpanHandle span, @NotNull Throwable error);
|
void endRedisSpan(@Nullable RedisSpan span, @NotNull Throwable error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ Provider<EnvelopeJarTask> envelopeJarTaskProvider = tasks.named(EnvelopePlugin.E
|
|||||||
tasks.named(NativeImagePlugin.CONFIGURE_NATIVE_IMAGE_TASK_NAME, NativeImageConfigurationTask) {
|
tasks.named(NativeImagePlugin.CONFIGURE_NATIVE_IMAGE_TASK_NAME, NativeImageConfigurationTask) {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(25)
|
languageVersion = JavaLanguageVersion.of(25)
|
||||||
vendor = JvmVendorSpec.ORACLE
|
vendor = JvmVendorSpec.GRAAL_VM
|
||||||
}
|
}
|
||||||
mainClass = "net.woggioni.rbcs.cli.graal.GraalNativeImageConfiguration"
|
mainClass = "net.woggioni.rbcs.cli.graal.GraalNativeImageConfiguration"
|
||||||
classpath = project.files(
|
classpath = project.files(
|
||||||
@@ -108,10 +108,10 @@ tasks.named(NativeImagePlugin.CONFIGURE_NATIVE_IMAGE_TASK_NAME, NativeImageConfi
|
|||||||
nativeImage {
|
nativeImage {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(25)
|
languageVersion = JavaLanguageVersion.of(25)
|
||||||
vendor = JvmVendorSpec.ORACLE
|
vendor = JvmVendorSpec.GRAAL_VM
|
||||||
}
|
}
|
||||||
mainClass = mainClassName
|
mainClass = mainClassName
|
||||||
//mainModule = mainModuleName
|
// mainModule = mainModuleName
|
||||||
useMusl = true
|
useMusl = true
|
||||||
buildStaticImage = true
|
buildStaticImage = true
|
||||||
linkAtBuildTime = false
|
linkAtBuildTime = false
|
||||||
@@ -119,7 +119,6 @@ nativeImage {
|
|||||||
compressExecutable = true
|
compressExecutable = true
|
||||||
compressionLevel = 6
|
compressionLevel = 6
|
||||||
useLZMA = false
|
useLZMA = false
|
||||||
//verbose = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Provider<UpxTask> upxTaskProvider = tasks.named(NativeImagePlugin.UPX_TASK_NAME, UpxTask) {
|
Provider<UpxTask> upxTaskProvider = tasks.named(NativeImagePlugin.UPX_TASK_NAME, UpxTask) {
|
||||||
@@ -128,7 +127,7 @@ Provider<UpxTask> upxTaskProvider = tasks.named(NativeImagePlugin.UPX_TASK_NAME,
|
|||||||
Provider<JlinkTask> jlinkTaskProvider = tasks.named(JlinkPlugin.JLINK_TASK_NAME, JlinkTask) {
|
Provider<JlinkTask> jlinkTaskProvider = tasks.named(JlinkPlugin.JLINK_TASK_NAME, JlinkTask) {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(25)
|
languageVersion = JavaLanguageVersion.of(25)
|
||||||
vendor = JvmVendorSpec.ORACLE
|
vendor = JvmVendorSpec.GRAAL_VM
|
||||||
}
|
}
|
||||||
|
|
||||||
mainClass = mainClassName
|
mainClass = mainClassName
|
||||||
@@ -153,6 +152,7 @@ Provider<JlinkTask> jlinkTaskProvider = tasks.named(JlinkPlugin.JLINK_TASK_NAME,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Provider<Tar> jlinkDistTarTaskProvider = tasks.named(JlinkPlugin.JLINK_DIST_TAR_TASK_NAME, Tar) {
|
Provider<Tar> jlinkDistTarTaskProvider = tasks.named(JlinkPlugin.JLINK_DIST_TAR_TASK_NAME, Tar) {
|
||||||
|
exclude 'lib/libjvmcicompiler.so'
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named(JavaPlugin.PROCESS_RESOURCES_TASK_NAME, ProcessResources) {
|
tasks.named(JavaPlugin.PROCESS_RESOURCES_TASK_NAME, ProcessResources) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,11 +1,2 @@
|
|||||||
Args=-O3 \
|
Args=-O3 -march=x86-64-v2 --gc=serial --initialize-at-run-time=io.netty --enable-url-protocols=jpms -H:+UnlockExperimentalVMOptions -H:+SharedArenaSupport --initialize-at-build-time=net.woggioni.rbcs.common.RbcsUrlStreamHandlerFactory,net.woggioni.rbcs.common.RbcsUrlStreamHandlerFactory$JpmsHandler
|
||||||
-march=x86-64-v3 \
|
|
||||||
--gc=serial \
|
|
||||||
--enable-url-protocols=jpms \
|
|
||||||
--pgo=native-image/default.iprof \
|
|
||||||
--initialize-at-run-time=io.netty \
|
|
||||||
--initialize-at-build-time=net.woggioni.rbcs.common.RbcsUrlStreamHandlerFactory,net.woggioni.rbcs.common.RbcsUrlStreamHandlerFactory$JpmsHandler \
|
|
||||||
--trace-object-instantiation=ch.qos.logback.classic.Logger \
|
|
||||||
-H:+UnlockExperimentalVMOptions \
|
|
||||||
-H:+SharedArenaSupport
|
|
||||||
#-H:TraceClassInitialization=io.netty.handler.ssl.BouncyCastleAlpnSslUtils
|
#-H:TraceClassInitialization=io.netty.handler.ssl.BouncyCastleAlpnSslUtils
|
||||||
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -7,8 +7,6 @@ import java.time.Duration
|
|||||||
import java.time.temporal.ChronoUnit
|
import java.time.temporal.ChronoUnit
|
||||||
import java.util.concurrent.ExecutionException
|
import java.util.concurrent.ExecutionException
|
||||||
import java.util.zip.Deflater
|
import java.util.zip.Deflater
|
||||||
import net.woggioni.rbcs.client.Configuration as ClientConfiguration
|
|
||||||
import net.woggioni.rbcs.client.impl.Parser as ClientConfigurationParser
|
|
||||||
import net.woggioni.jwo.NullOutputStream
|
import net.woggioni.jwo.NullOutputStream
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import net.woggioni.rbcs.api.Configuration.User
|
import net.woggioni.rbcs.api.Configuration.User
|
||||||
@@ -18,6 +16,8 @@ import net.woggioni.rbcs.cli.impl.commands.BenchmarkCommand
|
|||||||
import net.woggioni.rbcs.cli.impl.commands.GetCommand
|
import net.woggioni.rbcs.cli.impl.commands.GetCommand
|
||||||
import net.woggioni.rbcs.cli.impl.commands.HealthCheckCommand
|
import net.woggioni.rbcs.cli.impl.commands.HealthCheckCommand
|
||||||
import net.woggioni.rbcs.cli.impl.commands.PutCommand
|
import net.woggioni.rbcs.cli.impl.commands.PutCommand
|
||||||
|
import net.woggioni.rbcs.client.Configuration as ClientConfiguration
|
||||||
|
import net.woggioni.rbcs.client.impl.Parser as ClientConfigurationParser
|
||||||
import net.woggioni.rbcs.common.HostAndPort
|
import net.woggioni.rbcs.common.HostAndPort
|
||||||
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
||||||
import net.woggioni.rbcs.common.RBCS
|
import net.woggioni.rbcs.common.RBCS
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ import net.woggioni.rbcs.cli.impl.commands.HealthCheckCommand
|
|||||||
import net.woggioni.rbcs.cli.impl.commands.PasswordHashCommand
|
import net.woggioni.rbcs.cli.impl.commands.PasswordHashCommand
|
||||||
import net.woggioni.rbcs.cli.impl.commands.PutCommand
|
import net.woggioni.rbcs.cli.impl.commands.PutCommand
|
||||||
import net.woggioni.rbcs.cli.impl.commands.ServerCommand
|
import net.woggioni.rbcs.cli.impl.commands.ServerCommand
|
||||||
import net.woggioni.rbcs.common.RBCS.loadService
|
|
||||||
import net.woggioni.rbcs.common.RbcsUrlStreamHandlerFactory
|
import net.woggioni.rbcs.common.RbcsUrlStreamHandlerFactory
|
||||||
import net.woggioni.rbcs.common.createLogger
|
import net.woggioni.rbcs.common.createLogger
|
||||||
import picocli.CommandLine
|
import picocli.CommandLine
|
||||||
import picocli.CommandLine.Model.CommandSpec
|
import picocli.CommandLine.Model.CommandSpec
|
||||||
|
import java.util.ServiceLoader
|
||||||
|
import net.woggioni.rbcs.common.RBCS.loadService
|
||||||
|
|
||||||
|
|
||||||
@CommandLine.Command(
|
@CommandLine.Command(
|
||||||
|
|||||||
@@ -1,19 +1,5 @@
|
|||||||
package net.woggioni.rbcs.client
|
package net.woggioni.rbcs.client
|
||||||
|
|
||||||
import java.io.IOException
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.net.URI
|
|
||||||
import java.security.cert.X509Certificate
|
|
||||||
import java.util.Base64
|
|
||||||
import java.util.concurrent.CompletableFuture
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
import java.util.concurrent.TimeoutException
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
|
||||||
import javax.net.ssl.TrustManagerFactory
|
|
||||||
import javax.net.ssl.X509ExtendedTrustManager
|
|
||||||
import javax.net.ssl.X509TrustManager
|
|
||||||
import kotlin.random.Random
|
|
||||||
import io.netty.util.concurrent.Future as NettyFuture
|
|
||||||
import io.netty.bootstrap.Bootstrap
|
import io.netty.bootstrap.Bootstrap
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
import io.netty.buffer.Unpooled
|
import io.netty.buffer.Unpooled
|
||||||
@@ -48,7 +34,20 @@ import io.netty.handler.timeout.IdleState
|
|||||||
import io.netty.handler.timeout.IdleStateEvent
|
import io.netty.handler.timeout.IdleStateEvent
|
||||||
import io.netty.handler.timeout.IdleStateHandler
|
import io.netty.handler.timeout.IdleStateHandler
|
||||||
import io.netty.util.concurrent.Future
|
import io.netty.util.concurrent.Future
|
||||||
|
import io.netty.util.concurrent.Future as NettyFuture
|
||||||
import io.netty.util.concurrent.GenericFutureListener
|
import io.netty.util.concurrent.GenericFutureListener
|
||||||
|
import java.io.IOException
|
||||||
|
import java.net.InetSocketAddress
|
||||||
|
import java.net.URI
|
||||||
|
import java.security.cert.X509Certificate
|
||||||
|
import java.util.Base64
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import java.util.concurrent.TimeoutException
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
import javax.net.ssl.TrustManagerFactory
|
||||||
|
import javax.net.ssl.X509TrustManager
|
||||||
|
import kotlin.random.Random
|
||||||
import net.woggioni.rbcs.api.CacheValueMetadata
|
import net.woggioni.rbcs.api.CacheValueMetadata
|
||||||
import net.woggioni.rbcs.common.RBCS.loadKeystore
|
import net.woggioni.rbcs.common.RBCS.loadKeystore
|
||||||
import net.woggioni.rbcs.common.createLogger
|
import net.woggioni.rbcs.common.createLogger
|
||||||
@@ -75,25 +74,13 @@ class RemoteBuildCacheClient(private val profile: Configuration.Profile) : AutoC
|
|||||||
)
|
)
|
||||||
profile.tlsTruststore?.let { trustStore ->
|
profile.tlsTruststore?.let { trustStore ->
|
||||||
if (!trustStore.verifyServerCertificate) {
|
if (!trustStore.verifyServerCertificate) {
|
||||||
trustManager(object : X509ExtendedTrustManager() {
|
trustManager(object : X509TrustManager {
|
||||||
override fun checkClientTrusted(certChain: Array<out X509Certificate>, p1: String?) {
|
override fun checkClientTrusted(certChain: Array<out X509Certificate>, p1: String?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun checkClientTrusted(certChain: Array<out X509Certificate>, p1: String?, socket: java.net.Socket) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkClientTrusted(certChain: Array<out X509Certificate>, p1: String?, engine: javax.net.ssl.SSLEngine) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkServerTrusted(certChain: Array<out X509Certificate>, p1: String?) {
|
override fun checkServerTrusted(certChain: Array<out X509Certificate>, p1: String?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun checkServerTrusted(certChain: Array<out X509Certificate>, p1: String?, socket: java.net.Socket) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkServerTrusted(certChain: Array<out X509Certificate>, p1: String?, engine: javax.net.ssl.SSLEngine) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getAcceptedIssuers() = null
|
override fun getAcceptedIssuers() = null
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package net.woggioni.rbcs.client
|
package net.woggioni.rbcs.client
|
||||||
|
|
||||||
|
import io.netty.util.concurrent.EventExecutorGroup
|
||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import io.netty.util.concurrent.EventExecutorGroup
|
|
||||||
|
|
||||||
sealed class OperationOutcome<T> {
|
sealed class OperationOutcome<T> {
|
||||||
class Success<T>(val result: T) : OperationOutcome<T>()
|
class Success<T>(val result: T) : OperationOutcome<T>()
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package net.woggioni.rbcs.client
|
package net.woggioni.rbcs.client
|
||||||
|
|
||||||
|
import io.netty.util.concurrent.DefaultEventExecutorGroup
|
||||||
|
import io.netty.util.concurrent.EventExecutorGroup
|
||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import io.netty.util.concurrent.DefaultEventExecutorGroup
|
|
||||||
import io.netty.util.concurrent.EventExecutorGroup
|
|
||||||
import net.woggioni.rbcs.common.contextLogger
|
import net.woggioni.rbcs.common.contextLogger
|
||||||
import org.junit.jupiter.api.Assertions
|
import org.junit.jupiter.api.Assertions
|
||||||
import org.junit.jupiter.api.extension.ExtensionContext
|
import org.junit.jupiter.api.extension.ExtensionContext
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package net.woggioni.rbcs.common
|
package net.woggioni.rbcs.common
|
||||||
|
|
||||||
import java.io.InputStream
|
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
|
import java.io.InputStream
|
||||||
|
|
||||||
class ByteBufInputStream(private val buf : ByteBuf) : InputStream() {
|
class ByteBufInputStream(private val buf : ByteBuf) : InputStream() {
|
||||||
override fun read(): Int {
|
override fun read(): Int {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package net.woggioni.rbcs.common
|
package net.woggioni.rbcs.common
|
||||||
|
|
||||||
import java.io.OutputStream
|
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
|
import java.io.OutputStream
|
||||||
|
|
||||||
class ByteBufOutputStream(private val buf : ByteBuf) : OutputStream() {
|
class ByteBufOutputStream(private val buf : ByteBuf) : OutputStream() {
|
||||||
override fun write(b: Int) {
|
override fun write(b: Int) {
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package net.woggioni.rbcs.common
|
package net.woggioni.rbcs.common
|
||||||
|
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.Path
|
|
||||||
import java.util.logging.LogManager
|
|
||||||
import io.netty.channel.Channel
|
import io.netty.channel.Channel
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import net.woggioni.jwo.LoggerController
|
import net.woggioni.jwo.LoggerController
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Path
|
||||||
|
import java.util.logging.LogManager
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
import org.slf4j.MDC
|
import org.slf4j.MDC
|
||||||
import org.slf4j.event.Level
|
import org.slf4j.event.Level
|
||||||
import org.slf4j.spi.LoggingEventBuilder
|
import org.slf4j.spi.LoggingEventBuilder
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package net.woggioni.rbcs.common
|
package net.woggioni.rbcs.common
|
||||||
|
|
||||||
|
import net.woggioni.jwo.JWO
|
||||||
|
import net.woggioni.jwo.Tuple2
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import java.net.ServerSocket
|
import java.net.ServerSocket
|
||||||
@@ -9,20 +11,10 @@ import java.nio.file.Files
|
|||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.security.KeyStore
|
import java.security.KeyStore
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import java.security.cert.CertPathValidator
|
import java.security.cert.*
|
||||||
import java.security.cert.CertPathValidatorException
|
import java.util.*
|
||||||
import java.security.cert.CertificateException
|
|
||||||
import java.security.cert.CertificateFactory
|
|
||||||
import java.security.cert.PKIXParameters
|
|
||||||
import java.security.cert.PKIXRevocationChecker
|
|
||||||
import java.security.cert.X509Certificate
|
|
||||||
import java.util.EnumSet
|
|
||||||
import java.util.ServiceLoader
|
|
||||||
import javax.net.ssl.TrustManagerFactory
|
import javax.net.ssl.TrustManagerFactory
|
||||||
import javax.net.ssl.X509ExtendedTrustManager
|
|
||||||
import javax.net.ssl.X509TrustManager
|
import javax.net.ssl.X509TrustManager
|
||||||
import net.woggioni.jwo.JWO
|
|
||||||
import net.woggioni.jwo.Tuple2
|
|
||||||
|
|
||||||
object RBCS {
|
object RBCS {
|
||||||
fun String.toUrl(): URL = URL.of(URI(this), null)
|
fun String.toUrl(): URL = URL.of(URI(this), null)
|
||||||
@@ -125,7 +117,7 @@ object RBCS {
|
|||||||
return keystore
|
return keystore
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTrustManager(trustStore: KeyStore?, certificateRevocationEnabled: Boolean): X509ExtendedTrustManager {
|
fun getTrustManager(trustStore: KeyStore?, certificateRevocationEnabled: Boolean): X509TrustManager {
|
||||||
return if (trustStore != null) {
|
return if (trustStore != null) {
|
||||||
val certificateFactory = CertificateFactory.getInstance("X.509")
|
val certificateFactory = CertificateFactory.getInstance("X.509")
|
||||||
val validator = CertPathValidator.getInstance("PKIX").apply {
|
val validator = CertPathValidator.getInstance("PKIX").apply {
|
||||||
@@ -137,7 +129,7 @@ object RBCS {
|
|||||||
val params = PKIXParameters(trustStore).apply {
|
val params = PKIXParameters(trustStore).apply {
|
||||||
isRevocationEnabled = certificateRevocationEnabled
|
isRevocationEnabled = certificateRevocationEnabled
|
||||||
}
|
}
|
||||||
object : X509ExtendedTrustManager() {
|
object : X509TrustManager {
|
||||||
override fun checkClientTrusted(chain: Array<out X509Certificate>, authType: String) {
|
override fun checkClientTrusted(chain: Array<out X509Certificate>, authType: String) {
|
||||||
val clientCertificateChain = certificateFactory.generateCertPath(chain.toList())
|
val clientCertificateChain = certificateFactory.generateCertPath(chain.toList())
|
||||||
try {
|
try {
|
||||||
@@ -147,26 +139,10 @@ object RBCS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun checkClientTrusted(chain: Array<out X509Certificate>, authType: String, socket: java.net.Socket) {
|
|
||||||
checkClientTrusted(chain, authType)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkClientTrusted(chain: Array<out X509Certificate>, authType: String, engine: javax.net.ssl.SSLEngine) {
|
|
||||||
checkClientTrusted(chain, authType)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkServerTrusted(chain: Array<out X509Certificate>, authType: String) {
|
override fun checkServerTrusted(chain: Array<out X509Certificate>, authType: String) {
|
||||||
throw NotImplementedError()
|
throw NotImplementedError()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun checkServerTrusted(chain: Array<out X509Certificate>, authType: String, socket: java.net.Socket) {
|
|
||||||
checkServerTrusted(chain, authType)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkServerTrusted(chain: Array<out X509Certificate>, authType: String, engine: javax.net.ssl.SSLEngine) {
|
|
||||||
checkServerTrusted(chain, authType)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val acceptedIssuers = trustStore.aliases().asSequence()
|
private val acceptedIssuers = trustStore.aliases().asSequence()
|
||||||
.filter(trustStore::isCertificateEntry)
|
.filter(trustStore::isCertificateEntry)
|
||||||
.map(trustStore::getCertificate)
|
.map(trustStore::getCertificate)
|
||||||
@@ -178,8 +154,8 @@ object RBCS {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
|
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
|
||||||
trustManagerFactory.trustManagers.asSequence().filter { it is X509ExtendedTrustManager }
|
trustManagerFactory.trustManagers.asSequence().filter { it is X509TrustManager }
|
||||||
.single() as X509ExtendedTrustManager
|
.single() as X509TrustManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ import javax.xml.transform.stream.StreamResult
|
|||||||
import javax.xml.transform.stream.StreamSource
|
import javax.xml.transform.stream.StreamSource
|
||||||
import javax.xml.validation.Schema
|
import javax.xml.validation.Schema
|
||||||
import javax.xml.validation.SchemaFactory
|
import javax.xml.validation.SchemaFactory
|
||||||
import org.xml.sax.ErrorHandler as ErrHandler
|
|
||||||
import net.woggioni.jwo.JWO
|
import net.woggioni.jwo.JWO
|
||||||
import org.slf4j.event.Level
|
import org.slf4j.event.Level
|
||||||
import org.w3c.dom.Document
|
import org.w3c.dom.Document
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
import org.w3c.dom.Node
|
import org.w3c.dom.Node
|
||||||
import org.w3c.dom.NodeList
|
import org.w3c.dom.NodeList
|
||||||
|
import org.xml.sax.ErrorHandler as ErrHandler
|
||||||
import org.xml.sax.SAXNotRecognizedException
|
import org.xml.sax.SAXNotRecognizedException
|
||||||
import org.xml.sax.SAXNotSupportedException
|
import org.xml.sax.SAXNotSupportedException
|
||||||
import org.xml.sax.SAXParseException
|
import org.xml.sax.SAXParseException
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import net.woggioni.rbcs.api.CacheProvider;
|
import net.woggioni.rbcs.api.CacheProvider;
|
||||||
import net.woggioni.rbcs.api.TelemetryController;
|
|
||||||
|
|
||||||
module net.woggioni.rbcs.server.memcache {
|
module net.woggioni.rbcs.server.memcache {
|
||||||
requires net.woggioni.rbcs.common;
|
requires net.woggioni.rbcs.common;
|
||||||
@@ -17,7 +16,5 @@ module net.woggioni.rbcs.server.memcache {
|
|||||||
|
|
||||||
provides CacheProvider with net.woggioni.rbcs.server.memcache.MemcacheCacheProvider;
|
provides CacheProvider with net.woggioni.rbcs.server.memcache.MemcacheCacheProvider;
|
||||||
|
|
||||||
uses TelemetryController;
|
|
||||||
|
|
||||||
opens net.woggioni.rbcs.server.memcache.schema;
|
opens net.woggioni.rbcs.server.memcache.schema;
|
||||||
}
|
}
|
||||||
+5
-5
@@ -1,15 +1,15 @@
|
|||||||
package net.woggioni.rbcs.server.memcache
|
package net.woggioni.rbcs.server.memcache
|
||||||
|
|
||||||
import java.time.Duration
|
|
||||||
import java.util.concurrent.CompletableFuture
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
|
||||||
import java.util.concurrent.atomic.AtomicReference
|
|
||||||
import io.netty.channel.ChannelFactory
|
import io.netty.channel.ChannelFactory
|
||||||
import io.netty.channel.EventLoopGroup
|
import io.netty.channel.EventLoopGroup
|
||||||
import io.netty.channel.pool.FixedChannelPool
|
import io.netty.channel.pool.FixedChannelPool
|
||||||
import io.netty.channel.socket.DatagramChannel
|
import io.netty.channel.socket.DatagramChannel
|
||||||
import io.netty.channel.socket.SocketChannel
|
import io.netty.channel.socket.SocketChannel
|
||||||
|
import java.time.Duration
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
import java.util.concurrent.atomic.AtomicReference
|
||||||
import net.woggioni.rbcs.api.CacheHandler
|
import net.woggioni.rbcs.api.CacheHandler
|
||||||
import net.woggioni.rbcs.api.CacheHandlerFactory
|
import net.woggioni.rbcs.api.CacheHandlerFactory
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
|
|||||||
+24
-81
@@ -1,26 +1,9 @@
|
|||||||
package net.woggioni.rbcs.server.memcache
|
package net.woggioni.rbcs.server.memcache
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream
|
|
||||||
import java.io.ObjectInputStream
|
|
||||||
import java.io.ObjectOutputStream
|
|
||||||
import java.nio.ByteBuffer
|
|
||||||
import java.nio.channels.Channels
|
|
||||||
import java.nio.channels.FileChannel
|
|
||||||
import java.nio.channels.ReadableByteChannel
|
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.StandardOpenOption
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.time.Duration
|
|
||||||
import java.time.Instant
|
|
||||||
import java.util.concurrent.CompletableFuture
|
|
||||||
import java.util.concurrent.atomic.AtomicReference
|
|
||||||
import java.util.zip.Deflater
|
|
||||||
import java.util.zip.DeflaterOutputStream
|
|
||||||
import java.util.zip.InflaterOutputStream
|
|
||||||
import io.netty.channel.Channel as NettyChannel
|
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
import io.netty.buffer.ByteBufAllocator
|
import io.netty.buffer.ByteBufAllocator
|
||||||
import io.netty.buffer.CompositeByteBuf
|
import io.netty.buffer.CompositeByteBuf
|
||||||
|
import io.netty.channel.Channel as NettyChannel
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import io.netty.handler.codec.memcache.DefaultLastMemcacheContent
|
import io.netty.handler.codec.memcache.DefaultLastMemcacheContent
|
||||||
import io.netty.handler.codec.memcache.DefaultMemcacheContent
|
import io.netty.handler.codec.memcache.DefaultMemcacheContent
|
||||||
@@ -30,6 +13,21 @@ import io.netty.handler.codec.memcache.binary.BinaryMemcacheOpcodes
|
|||||||
import io.netty.handler.codec.memcache.binary.BinaryMemcacheResponse
|
import io.netty.handler.codec.memcache.binary.BinaryMemcacheResponse
|
||||||
import io.netty.handler.codec.memcache.binary.BinaryMemcacheResponseStatus
|
import io.netty.handler.codec.memcache.binary.BinaryMemcacheResponseStatus
|
||||||
import io.netty.handler.codec.memcache.binary.DefaultBinaryMemcacheRequest
|
import io.netty.handler.codec.memcache.binary.DefaultBinaryMemcacheRequest
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.ObjectInputStream
|
||||||
|
import java.io.ObjectOutputStream
|
||||||
|
import java.nio.ByteBuffer
|
||||||
|
import java.nio.channels.Channels
|
||||||
|
import java.nio.channels.FileChannel
|
||||||
|
import java.nio.channels.ReadableByteChannel
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.StandardOpenOption
|
||||||
|
import java.time.Duration
|
||||||
|
import java.time.Instant
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
import java.util.zip.Deflater
|
||||||
|
import java.util.zip.DeflaterOutputStream
|
||||||
|
import java.util.zip.InflaterOutputStream
|
||||||
import net.woggioni.rbcs.api.CacheHandler
|
import net.woggioni.rbcs.api.CacheHandler
|
||||||
import net.woggioni.rbcs.api.CacheValueMetadata
|
import net.woggioni.rbcs.api.CacheValueMetadata
|
||||||
import net.woggioni.rbcs.api.exception.ContentTooLargeException
|
import net.woggioni.rbcs.api.exception.ContentTooLargeException
|
||||||
@@ -41,11 +39,8 @@ import net.woggioni.rbcs.api.message.CacheMessage.CachePutResponse
|
|||||||
import net.woggioni.rbcs.api.message.CacheMessage.CacheValueFoundResponse
|
import net.woggioni.rbcs.api.message.CacheMessage.CacheValueFoundResponse
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage.CacheValueNotFoundResponse
|
import net.woggioni.rbcs.api.message.CacheMessage.CacheValueNotFoundResponse
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage.LastCacheContent
|
import net.woggioni.rbcs.api.message.CacheMessage.LastCacheContent
|
||||||
import net.woggioni.rbcs.api.SpanHandle
|
|
||||||
import net.woggioni.rbcs.api.TelemetryController
|
|
||||||
import net.woggioni.rbcs.common.ByteBufInputStream
|
import net.woggioni.rbcs.common.ByteBufInputStream
|
||||||
import net.woggioni.rbcs.common.ByteBufOutputStream
|
import net.woggioni.rbcs.common.ByteBufOutputStream
|
||||||
import net.woggioni.rbcs.common.RBCS.loadService
|
|
||||||
import net.woggioni.rbcs.common.RBCS.processCacheKey
|
import net.woggioni.rbcs.common.RBCS.processCacheKey
|
||||||
import net.woggioni.rbcs.common.RBCS.toIntOrNull
|
import net.woggioni.rbcs.common.RBCS.toIntOrNull
|
||||||
import net.woggioni.rbcs.common.createLogger
|
import net.woggioni.rbcs.common.createLogger
|
||||||
@@ -75,10 +70,6 @@ class MemcacheCacheHandler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val telemetryController by lazy {
|
|
||||||
loadService(TelemetryController::class.java).firstOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
private interface InProgressRequest {
|
private interface InProgressRequest {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -162,9 +153,7 @@ class MemcacheCacheHandler(
|
|||||||
metadata: CacheValueMetadata,
|
metadata: CacheValueMetadata,
|
||||||
val digest: ByteBuf,
|
val digest: ByteBuf,
|
||||||
val requestController: CompletableFuture<MemcacheRequestController>,
|
val requestController: CompletableFuture<MemcacheRequestController>,
|
||||||
private val alloc: ByteBufAllocator,
|
private val alloc: ByteBufAllocator
|
||||||
val entryKey: String,
|
|
||||||
val memcacheSpanRef: AtomicReference<SpanHandle?>,
|
|
||||||
) : InProgressRequest {
|
) : InProgressRequest {
|
||||||
private var totalSize = 0
|
private var totalSize = 0
|
||||||
private var tmpFile: FileChannel? = null
|
private var tmpFile: FileChannel? = null
|
||||||
@@ -262,17 +251,6 @@ class MemcacheCacheHandler(
|
|||||||
val key = ctx.alloc().buffer().also {
|
val key = ctx.alloc().buffer().also {
|
||||||
it.writeBytes(processCacheKey(msg.key, keyPrefix, digestAlgorithm))
|
it.writeBytes(processCacheKey(msg.key, keyPrefix, digestAlgorithm))
|
||||||
}
|
}
|
||||||
val memcacheSpan = telemetryController?.startSpan("GET")?.apply {
|
|
||||||
setAttribute("db.system", "memcache")
|
|
||||||
setAttribute("db.operation.name", "GET")
|
|
||||||
val remoteAddr = ctx.channel().remoteAddress()
|
|
||||||
if (remoteAddr is InetSocketAddress) {
|
|
||||||
remoteAddr.hostString?.let {
|
|
||||||
setAttribute("server.address", it)
|
|
||||||
}
|
|
||||||
setAttribute("server.port", remoteAddr.port.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val responseHandler = object : MemcacheResponseHandler {
|
val responseHandler = object : MemcacheResponseHandler {
|
||||||
override fun responseReceived(response: BinaryMemcacheResponse) {
|
override fun responseReceived(response: BinaryMemcacheResponse) {
|
||||||
val status = response.status()
|
val status = response.status()
|
||||||
@@ -288,15 +266,8 @@ class MemcacheCacheHandler(
|
|||||||
log.debug(ctx) {
|
log.debug(ctx) {
|
||||||
"Cache miss for key ${msg.key} on memcache"
|
"Cache miss for key ${msg.key} on memcache"
|
||||||
}
|
}
|
||||||
telemetryController?.endSpan(memcacheSpan)
|
|
||||||
sendMessageAndFlush(ctx, CacheValueNotFoundResponse(msg.key))
|
sendMessageAndFlush(ctx, CacheValueNotFoundResponse(msg.key))
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
|
||||||
val ex = MemcacheException(status)
|
|
||||||
telemetryController?.endSpan(memcacheSpan, ex)
|
|
||||||
this@MemcacheCacheHandler.exceptionCaught(ctx, ex)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,13 +282,11 @@ class MemcacheCacheHandler(
|
|||||||
if (content is LastMemcacheContent) {
|
if (content is LastMemcacheContent) {
|
||||||
inProgressRequest = null
|
inProgressRequest = null
|
||||||
inProgressGetRequest.commit()
|
inProgressGetRequest.commit()
|
||||||
telemetryController?.endSpan(memcacheSpan)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun exceptionCaught(ex: Throwable) {
|
override fun exceptionCaught(ex: Throwable) {
|
||||||
telemetryController?.endSpan(memcacheSpan, ex)
|
|
||||||
(inProgressRequest as? InProgressGetRequest).let { inProgressGetRequest ->
|
(inProgressRequest as? InProgressGetRequest).let { inProgressGetRequest ->
|
||||||
inProgressGetRequest?.let {
|
inProgressGetRequest?.let {
|
||||||
inProgressRequest = null
|
inProgressRequest = null
|
||||||
@@ -343,7 +312,6 @@ class MemcacheCacheHandler(
|
|||||||
val key = ctx.alloc().buffer().also {
|
val key = ctx.alloc().buffer().also {
|
||||||
it.writeBytes(processCacheKey(msg.key, keyPrefix, digestAlgorithm))
|
it.writeBytes(processCacheKey(msg.key, keyPrefix, digestAlgorithm))
|
||||||
}
|
}
|
||||||
val memcacheSpanRef = AtomicReference<SpanHandle?>(null)
|
|
||||||
val responseHandler = object : MemcacheResponseHandler {
|
val responseHandler = object : MemcacheResponseHandler {
|
||||||
override fun responseReceived(response: BinaryMemcacheResponse) {
|
override fun responseReceived(response: BinaryMemcacheResponse) {
|
||||||
val status = response.status()
|
val status = response.status()
|
||||||
@@ -352,22 +320,16 @@ class MemcacheCacheHandler(
|
|||||||
log.debug(ctx) {
|
log.debug(ctx) {
|
||||||
"Inserted key ${msg.key} into memcache"
|
"Inserted key ${msg.key} into memcache"
|
||||||
}
|
}
|
||||||
telemetryController?.endSpan(memcacheSpanRef.get())
|
|
||||||
sendMessageAndFlush(ctx, CachePutResponse(msg.key))
|
sendMessageAndFlush(ctx, CachePutResponse(msg.key))
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> this@MemcacheCacheHandler.exceptionCaught(ctx, MemcacheException(status))
|
||||||
val ex = MemcacheException(status)
|
|
||||||
telemetryController?.endSpan(memcacheSpanRef.get(), ex)
|
|
||||||
this@MemcacheCacheHandler.exceptionCaught(ctx, ex)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun contentReceived(content: MemcacheContent) {}
|
override fun contentReceived(content: MemcacheContent) {}
|
||||||
|
|
||||||
override fun exceptionCaught(ex: Throwable) {
|
override fun exceptionCaught(ex: Throwable) {
|
||||||
telemetryController?.endSpan(memcacheSpanRef.get(), ex)
|
|
||||||
this@MemcacheCacheHandler.exceptionCaught(ctx, ex)
|
this@MemcacheCacheHandler.exceptionCaught(ctx, ex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,7 +339,7 @@ class MemcacheCacheHandler(
|
|||||||
this@MemcacheCacheHandler.exceptionCaught(ctx, ex)
|
this@MemcacheCacheHandler.exceptionCaught(ctx, ex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inProgressRequest = InProgressPutRequest(ctx.channel(), msg.metadata, key, requestController, ctx.alloc(), msg.key, memcacheSpanRef)
|
inProgressRequest = InProgressPutRequest(ctx.channel(), msg.metadata, key, requestController, ctx.alloc())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleCacheContent(ctx: ChannelHandlerContext, msg: CacheContent) {
|
private fun handleCacheContent(ctx: ChannelHandlerContext, msg: CacheContent) {
|
||||||
@@ -400,41 +362,22 @@ class MemcacheCacheHandler(
|
|||||||
val request = inProgressRequest
|
val request = inProgressRequest
|
||||||
when (request) {
|
when (request) {
|
||||||
is InProgressPutRequest -> {
|
is InProgressPutRequest -> {
|
||||||
val putRequest = request
|
|
||||||
inProgressRequest = null
|
inProgressRequest = null
|
||||||
log.trace(ctx) {
|
log.trace(ctx) {
|
||||||
"Received last chunk of ${msg.content().readableBytes()} bytes for memcache"
|
"Received last chunk of ${msg.content().readableBytes()} bytes for memcache"
|
||||||
}
|
}
|
||||||
putRequest.write(msg.content())
|
request.write(msg.content())
|
||||||
val memcacheSpan = telemetryController?.startSpan("SET",
|
val key = request.digest.retainedDuplicate()
|
||||||
)?.apply {
|
val (payloadSize, payloadSource) = request.commit()
|
||||||
setAttribute("db.system", "memcache")
|
|
||||||
setAttribute("db.operation.name", "SET")
|
|
||||||
val remoteAddr = ctx.channel().remoteAddress()
|
|
||||||
if (remoteAddr is InetSocketAddress) {
|
|
||||||
remoteAddr.hostString?.let {
|
|
||||||
setAttribute("server.address", it)
|
|
||||||
}
|
|
||||||
setAttribute("server.port", remoteAddr.port.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
putRequest.memcacheSpanRef.set(memcacheSpan)
|
|
||||||
val key = putRequest.digest.retainedDuplicate()
|
|
||||||
val (payloadSize, payloadSource) = putRequest.commit()
|
|
||||||
val extras = ctx.alloc().buffer(8, 8)
|
val extras = ctx.alloc().buffer(8, 8)
|
||||||
extras.writeInt(0)
|
extras.writeInt(0)
|
||||||
extras.writeInt(encodeExpiry(maxAge))
|
extras.writeInt(encodeExpiry(maxAge))
|
||||||
val totalBodyLength = putRequest.digest.readableBytes() + extras.readableBytes() + payloadSize
|
val totalBodyLength = request.digest.readableBytes() + extras.readableBytes() + payloadSize
|
||||||
log.trace(ctx) {
|
log.trace(ctx) {
|
||||||
"Trying to send SET request to memcache"
|
"Trying to send SET request to memcache"
|
||||||
}
|
}
|
||||||
putRequest.requestController.whenComplete { requestController, ex ->
|
request.requestController.whenComplete { requestController, ex ->
|
||||||
if (ex == null) {
|
if (ex == null) {
|
||||||
val remoteAddr = requestController.channel.remoteAddress()
|
|
||||||
if (remoteAddr is InetSocketAddress) {
|
|
||||||
remoteAddr.hostString?.let { memcacheSpan?.setAttribute("server.address", it) }
|
|
||||||
memcacheSpan?.setAttribute("server.port", remoteAddr.port.toLong())
|
|
||||||
}
|
|
||||||
log.trace(ctx) {
|
log.trace(ctx) {
|
||||||
"Sending SET request to memcache"
|
"Sending SET request to memcache"
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-7
@@ -1,11 +1,6 @@
|
|||||||
package net.woggioni.rbcs.server.memcache.client
|
package net.woggioni.rbcs.server.memcache.client
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.util.concurrent.CompletableFuture
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
|
||||||
import io.netty.util.concurrent.Future as NettyFuture
|
|
||||||
import io.netty.bootstrap.Bootstrap
|
import io.netty.bootstrap.Bootstrap
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
import io.netty.channel.Channel
|
import io.netty.channel.Channel
|
||||||
@@ -25,7 +20,12 @@ import io.netty.handler.codec.memcache.MemcacheObject
|
|||||||
import io.netty.handler.codec.memcache.binary.BinaryMemcacheClientCodec
|
import io.netty.handler.codec.memcache.binary.BinaryMemcacheClientCodec
|
||||||
import io.netty.handler.codec.memcache.binary.BinaryMemcacheRequest
|
import io.netty.handler.codec.memcache.binary.BinaryMemcacheRequest
|
||||||
import io.netty.handler.codec.memcache.binary.BinaryMemcacheResponse
|
import io.netty.handler.codec.memcache.binary.BinaryMemcacheResponse
|
||||||
|
import io.netty.util.concurrent.Future as NettyFuture
|
||||||
import io.netty.util.concurrent.GenericFutureListener
|
import io.netty.util.concurrent.GenericFutureListener
|
||||||
|
import java.io.IOException
|
||||||
|
import java.net.InetSocketAddress
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
import net.woggioni.rbcs.common.HostAndPort
|
import net.woggioni.rbcs.common.HostAndPort
|
||||||
import net.woggioni.rbcs.common.createLogger
|
import net.woggioni.rbcs.common.createLogger
|
||||||
import net.woggioni.rbcs.common.trace
|
import net.woggioni.rbcs.common.trace
|
||||||
@@ -147,8 +147,6 @@ class MemcacheClient(
|
|||||||
|
|
||||||
channel.pipeline().addLast(handler)
|
channel.pipeline().addLast(handler)
|
||||||
response.complete(object : MemcacheRequestController {
|
response.complete(object : MemcacheRequestController {
|
||||||
override val channel: Channel = channel
|
|
||||||
|
|
||||||
private var channelReleased = false
|
private var channelReleased = false
|
||||||
|
|
||||||
override fun sendRequest(request: BinaryMemcacheRequest) {
|
override fun sendRequest(request: BinaryMemcacheRequest) {
|
||||||
|
|||||||
-3
@@ -1,13 +1,10 @@
|
|||||||
package net.woggioni.rbcs.server.memcache.client
|
package net.woggioni.rbcs.server.memcache.client
|
||||||
|
|
||||||
import io.netty.channel.Channel
|
|
||||||
import io.netty.handler.codec.memcache.MemcacheContent
|
import io.netty.handler.codec.memcache.MemcacheContent
|
||||||
import io.netty.handler.codec.memcache.binary.BinaryMemcacheRequest
|
import io.netty.handler.codec.memcache.binary.BinaryMemcacheRequest
|
||||||
|
|
||||||
interface MemcacheRequestController {
|
interface MemcacheRequestController {
|
||||||
|
|
||||||
val channel: Channel
|
|
||||||
|
|
||||||
fun sendRequest(request : BinaryMemcacheRequest)
|
fun sendRequest(request : BinaryMemcacheRequest)
|
||||||
|
|
||||||
fun sendContent(content : MemcacheContent)
|
fun sendContent(content : MemcacheContent)
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
package net.woggioni.rbcs.server.memcache.client
|
package net.woggioni.rbcs.server.memcache.client
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBufUtil
|
||||||
|
import io.netty.buffer.Unpooled
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.nio.channels.Channels
|
import java.nio.channels.Channels
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import io.netty.buffer.ByteBufUtil
|
|
||||||
import io.netty.buffer.Unpooled
|
|
||||||
import org.junit.jupiter.api.Assertions
|
import org.junit.jupiter.api.Assertions
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ package net.woggioni.rbcs.server.otel
|
|||||||
|
|
||||||
import io.netty.channel.ChannelHandler
|
import io.netty.channel.ChannelHandler
|
||||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||||
import io.opentelemetry.api.common.AttributeKey
|
|
||||||
import io.opentelemetry.api.trace.SpanKind
|
import io.opentelemetry.api.trace.SpanKind
|
||||||
import io.opentelemetry.api.trace.StatusCode
|
import io.opentelemetry.api.trace.StatusCode
|
||||||
import io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender
|
import io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender
|
||||||
import io.opentelemetry.instrumentation.netty.v4_1.NettyServerTelemetry
|
import io.opentelemetry.instrumentation.netty.v4_1.NettyServerTelemetry
|
||||||
import io.opentelemetry.instrumentation.runtimetelemetry.RuntimeTelemetry
|
import io.opentelemetry.instrumentation.runtimetelemetry.RuntimeTelemetry
|
||||||
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk
|
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk
|
||||||
import net.woggioni.rbcs.api.SpanHandle
|
import net.woggioni.rbcs.api.RedisSpan
|
||||||
import net.woggioni.rbcs.api.TelemetryController
|
import net.woggioni.rbcs.api.TelemetryController
|
||||||
import net.woggioni.rbcs.common.createLogger
|
import net.woggioni.rbcs.common.createLogger
|
||||||
import net.woggioni.rbcs.common.info
|
import net.woggioni.rbcs.common.info
|
||||||
@@ -45,19 +44,21 @@ class OtelController : TelemetryController {
|
|||||||
return NettyServerTelemetry.create(GlobalOpenTelemetry.get()).createCombinedHandler()
|
return NettyServerTelemetry.create(GlobalOpenTelemetry.get()).createCombinedHandler()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun startSpan(name: String): SpanHandle {
|
override fun startRedisSpan(command: String, key: String): RedisSpan? {
|
||||||
val span = tracer.spanBuilder(name)
|
val span = tracer.spanBuilder(command)
|
||||||
.setSpanKind(SpanKind.CLIENT)
|
.setSpanKind(SpanKind.CLIENT)
|
||||||
|
.setAttribute("db.system", "redis")
|
||||||
|
.setAttribute("db.operation", command)
|
||||||
.startSpan()
|
.startSpan()
|
||||||
return OtelSpanHandle(span)
|
return RedisOtelSpan(span)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endSpan(span: SpanHandle?) {
|
override fun endRedisSpan(span: RedisSpan?) {
|
||||||
(span as? OtelSpanHandle)?.delegate?.end()
|
(span as? RedisOtelSpan)?.delegate?.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endSpan(span: SpanHandle?, error: Throwable) {
|
override fun endRedisSpan(span: RedisSpan?, error: Throwable) {
|
||||||
val s = (span as? OtelSpanHandle)?.delegate ?: return
|
val s = (span as? RedisOtelSpan)?.delegate ?: return
|
||||||
s.recordException(error)
|
s.recordException(error)
|
||||||
s.setStatus(StatusCode.ERROR)
|
s.setStatus(StatusCode.ERROR)
|
||||||
s.end()
|
s.end()
|
||||||
|
|||||||
+3
-7
@@ -1,11 +1,11 @@
|
|||||||
package net.woggioni.rbcs.server.otel
|
package net.woggioni.rbcs.server.otel
|
||||||
|
|
||||||
import io.opentelemetry.api.trace.Span
|
import io.opentelemetry.api.trace.Span
|
||||||
import net.woggioni.rbcs.api.SpanHandle
|
import net.woggioni.rbcs.api.RedisSpan
|
||||||
|
|
||||||
internal class OtelSpanHandle(
|
internal class RedisOtelSpan(
|
||||||
val delegate: Span,
|
val delegate: Span,
|
||||||
) : SpanHandle {
|
) : RedisSpan {
|
||||||
|
|
||||||
override fun setAttribute(key: String, value: String) {
|
override fun setAttribute(key: String, value: String) {
|
||||||
delegate.setAttribute(key, value)
|
delegate.setAttribute(key, value)
|
||||||
@@ -14,8 +14,4 @@ internal class OtelSpanHandle(
|
|||||||
override fun setAttribute(key: String, value: Long) {
|
override fun setAttribute(key: String, value: Long) {
|
||||||
delegate.setAttribute(key, value)
|
delegate.setAttribute(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setAttribute(key: String, value: Boolean) {
|
|
||||||
delegate.setAttribute(key, value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+7
-5
@@ -1,15 +1,17 @@
|
|||||||
package net.woggioni.rbcs.server.redis
|
package net.woggioni.rbcs.server.redis
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelFactory
|
||||||
|
import io.netty.channel.EventLoopGroup
|
||||||
|
import io.netty.channel.pool.FixedChannelPool
|
||||||
|
import io.netty.channel.socket.DatagramChannel
|
||||||
|
import io.netty.channel.socket.SocketChannel
|
||||||
|
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
import java.util.concurrent.atomic.AtomicReference
|
import java.util.concurrent.atomic.AtomicReference
|
||||||
import io.netty.channel.ChannelFactory
|
|
||||||
import io.netty.channel.EventLoopGroup
|
|
||||||
import io.netty.channel.pool.FixedChannelPool
|
|
||||||
import io.netty.channel.socket.DatagramChannel
|
|
||||||
import io.netty.channel.socket.SocketChannel
|
|
||||||
import net.woggioni.rbcs.api.CacheHandler
|
import net.woggioni.rbcs.api.CacheHandler
|
||||||
import net.woggioni.rbcs.api.CacheHandlerFactory
|
import net.woggioni.rbcs.api.CacheHandlerFactory
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
|
|||||||
+66
-79
@@ -1,5 +1,16 @@
|
|||||||
package net.woggioni.rbcs.server.redis
|
package net.woggioni.rbcs.server.redis
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf
|
||||||
|
import io.netty.buffer.ByteBufAllocator
|
||||||
|
import io.netty.buffer.CompositeByteBuf
|
||||||
|
import io.netty.channel.Channel as NettyChannel
|
||||||
|
import io.netty.channel.ChannelHandlerContext
|
||||||
|
import io.netty.handler.codec.redis.ArrayRedisMessage
|
||||||
|
import io.netty.handler.codec.redis.ErrorRedisMessage
|
||||||
|
import io.netty.handler.codec.redis.FullBulkStringRedisMessage
|
||||||
|
import io.netty.handler.codec.redis.RedisMessage
|
||||||
|
import io.netty.handler.codec.redis.SimpleStringRedisMessage
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.ObjectInputStream
|
import java.io.ObjectInputStream
|
||||||
import java.io.ObjectOutputStream
|
import java.io.ObjectOutputStream
|
||||||
@@ -15,16 +26,7 @@ import java.time.Duration
|
|||||||
import java.util.zip.Deflater
|
import java.util.zip.Deflater
|
||||||
import java.util.zip.DeflaterOutputStream
|
import java.util.zip.DeflaterOutputStream
|
||||||
import java.util.zip.InflaterOutputStream
|
import java.util.zip.InflaterOutputStream
|
||||||
import io.netty.channel.Channel as NettyChannel
|
|
||||||
import io.netty.buffer.ByteBuf
|
|
||||||
import io.netty.buffer.ByteBufAllocator
|
|
||||||
import io.netty.buffer.CompositeByteBuf
|
|
||||||
import io.netty.channel.ChannelHandlerContext
|
|
||||||
import io.netty.handler.codec.redis.ArrayRedisMessage
|
|
||||||
import io.netty.handler.codec.redis.ErrorRedisMessage
|
|
||||||
import io.netty.handler.codec.redis.FullBulkStringRedisMessage
|
|
||||||
import io.netty.handler.codec.redis.RedisMessage
|
|
||||||
import io.netty.handler.codec.redis.SimpleStringRedisMessage
|
|
||||||
import net.woggioni.rbcs.api.CacheHandler
|
import net.woggioni.rbcs.api.CacheHandler
|
||||||
import net.woggioni.rbcs.api.CacheValueMetadata
|
import net.woggioni.rbcs.api.CacheValueMetadata
|
||||||
import net.woggioni.rbcs.api.exception.ContentTooLargeException
|
import net.woggioni.rbcs.api.exception.ContentTooLargeException
|
||||||
@@ -36,6 +38,7 @@ import net.woggioni.rbcs.api.message.CacheMessage.CachePutResponse
|
|||||||
import net.woggioni.rbcs.api.message.CacheMessage.CacheValueFoundResponse
|
import net.woggioni.rbcs.api.message.CacheMessage.CacheValueFoundResponse
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage.CacheValueNotFoundResponse
|
import net.woggioni.rbcs.api.message.CacheMessage.CacheValueNotFoundResponse
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage.LastCacheContent
|
import net.woggioni.rbcs.api.message.CacheMessage.LastCacheContent
|
||||||
|
import net.woggioni.rbcs.api.RedisSpan
|
||||||
import net.woggioni.rbcs.api.TelemetryController
|
import net.woggioni.rbcs.api.TelemetryController
|
||||||
import net.woggioni.rbcs.common.ByteBufInputStream
|
import net.woggioni.rbcs.common.ByteBufInputStream
|
||||||
import net.woggioni.rbcs.common.ByteBufOutputStream
|
import net.woggioni.rbcs.common.ByteBufOutputStream
|
||||||
@@ -249,57 +252,48 @@ class RedisCacheHandler(
|
|||||||
}
|
}
|
||||||
val keyBytes = processCacheKey(msg.key, keyPrefix, digestAlgorithm)
|
val keyBytes = processCacheKey(msg.key, keyPrefix, digestAlgorithm)
|
||||||
val keyString = String(keyBytes, StandardCharsets.UTF_8)
|
val keyString = String(keyBytes, StandardCharsets.UTF_8)
|
||||||
val redisSpan = telemetryController?.startSpan("GET")?.apply {
|
val redisSpan = telemetryController?.startRedisSpan("GET", keyString)
|
||||||
setAttribute("db.system", "redis")
|
|
||||||
setAttribute("db.operation.name", "GET")
|
|
||||||
val remoteAddr = ctx.channel().remoteAddress()
|
|
||||||
if (remoteAddr is InetSocketAddress) {
|
|
||||||
remoteAddr.hostString?.let {
|
|
||||||
setAttribute("server.address", it)
|
|
||||||
}
|
|
||||||
setAttribute("server.port", remoteAddr.port.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val responseHandler = object : RedisResponseHandler {
|
val responseHandler = object : RedisResponseHandler {
|
||||||
override fun responseReceived(response: RedisMessage) {
|
override fun responseReceived(response: RedisMessage) {
|
||||||
when (response) {
|
try {
|
||||||
is FullBulkStringRedisMessage -> {
|
when (response) {
|
||||||
if (response === FullBulkStringRedisMessage.NULL_INSTANCE || response.content().readableBytes() == 0) {
|
is FullBulkStringRedisMessage -> {
|
||||||
log.debug(ctx) {
|
if (response === FullBulkStringRedisMessage.NULL_INSTANCE || response.content().readableBytes() == 0) {
|
||||||
"Cache miss for key ${msg.key} on Redis"
|
log.debug(ctx) {
|
||||||
|
"Cache miss for key ${msg.key} on Redis"
|
||||||
|
}
|
||||||
|
sendMessageAndFlush(ctx, CacheValueNotFoundResponse(msg.key))
|
||||||
|
} else {
|
||||||
|
log.debug(ctx) {
|
||||||
|
"Cache hit for key ${msg.key} on Redis"
|
||||||
|
}
|
||||||
|
val getRequest = InProgressGetRequest(msg.key, ctx)
|
||||||
|
inProgressRequest = getRequest
|
||||||
|
getRequest.processResponse(response.content())
|
||||||
|
inProgressRequest = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
is ErrorRedisMessage -> {
|
||||||
|
val ex = RedisException("Redis error for GET ${msg.key}: ${response.content()}")
|
||||||
|
telemetryController?.endRedisSpan(redisSpan, ex)
|
||||||
|
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
log.warn(ctx) {
|
||||||
|
"Unexpected response type from Redis for key ${msg.key}: ${response.javaClass.name}"
|
||||||
}
|
}
|
||||||
telemetryController?.endSpan(redisSpan)
|
|
||||||
sendMessageAndFlush(ctx, CacheValueNotFoundResponse(msg.key))
|
sendMessageAndFlush(ctx, CacheValueNotFoundResponse(msg.key))
|
||||||
} else {
|
|
||||||
log.debug(ctx) {
|
|
||||||
"Cache hit for key ${msg.key} on Redis"
|
|
||||||
}
|
|
||||||
telemetryController?.endSpan(redisSpan)
|
|
||||||
val getRequest = InProgressGetRequest(msg.key, ctx)
|
|
||||||
inProgressRequest = getRequest
|
|
||||||
getRequest.processResponse(response.content())
|
|
||||||
inProgressRequest = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
is ErrorRedisMessage -> {
|
telemetryController?.endRedisSpan(redisSpan)
|
||||||
val ex = RedisException("Redis error for GET ${msg.key}: ${response.content()}")
|
|
||||||
telemetryController?.endSpan(redisSpan, ex)
|
|
||||||
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
log.warn(ctx) {
|
|
||||||
"Unexpected response type from Redis for key ${msg.key}: ${response.javaClass.name}"
|
|
||||||
}
|
|
||||||
telemetryController?.endSpan(redisSpan)
|
|
||||||
sendMessageAndFlush(ctx, CacheValueNotFoundResponse(msg.key))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun exceptionCaught(ex: Throwable) {
|
override fun exceptionCaught(ex: Throwable) {
|
||||||
telemetryController?.endSpan(redisSpan, ex)
|
telemetryController?.endRedisSpan(redisSpan, ex)
|
||||||
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,45 +363,38 @@ class RedisCacheHandler(
|
|||||||
|
|
||||||
val expirySeconds = maxAge.toSeconds().toString()
|
val expirySeconds = maxAge.toSeconds().toString()
|
||||||
|
|
||||||
val redisSpan = telemetryController?.startSpan("SET")?.apply {
|
val redisSpan = telemetryController?.startRedisSpan("SET", request.keyString)
|
||||||
setAttribute("db.system", "redis")
|
|
||||||
setAttribute("db.operation.name", "SET")
|
|
||||||
val remoteAddr = ctx.channel().remoteAddress()
|
|
||||||
if (remoteAddr is InetSocketAddress) {
|
|
||||||
remoteAddr.hostString?.let {
|
|
||||||
setAttribute("server.address", it)
|
|
||||||
}
|
|
||||||
setAttribute("server.port", remoteAddr.port.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val responseHandler = object : RedisResponseHandler {
|
val responseHandler = object : RedisResponseHandler {
|
||||||
override fun responseReceived(response: RedisMessage) {
|
override fun responseReceived(response: RedisMessage) {
|
||||||
when (response) {
|
try {
|
||||||
is SimpleStringRedisMessage -> {
|
when (response) {
|
||||||
log.debug(ctx) {
|
is SimpleStringRedisMessage -> {
|
||||||
"Inserted key ${request.keyString} into Redis"
|
log.debug(ctx) {
|
||||||
|
"Inserted key ${request.keyString} into Redis"
|
||||||
|
}
|
||||||
|
sendMessageAndFlush(ctx, CachePutResponse(request.keyString))
|
||||||
}
|
}
|
||||||
telemetryController?.endSpan(redisSpan)
|
|
||||||
sendMessageAndFlush(ctx, CachePutResponse(request.keyString))
|
|
||||||
}
|
|
||||||
|
|
||||||
is ErrorRedisMessage -> {
|
is ErrorRedisMessage -> {
|
||||||
val ex = RedisException("Redis error for SET ${request.keyString}: ${response.content()}")
|
val ex = RedisException("Redis error for SET ${request.keyString}: ${response.content()}")
|
||||||
telemetryController?.endSpan(redisSpan, ex)
|
telemetryController?.endRedisSpan(redisSpan, ex)
|
||||||
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
val ex = RedisException("Unexpected response for SET ${request.keyString}: ${response.javaClass.name}")
|
val ex = RedisException("Unexpected response for SET ${request.keyString}: ${response.javaClass.name}")
|
||||||
telemetryController?.endSpan(redisSpan, ex)
|
telemetryController?.endRedisSpan(redisSpan, ex)
|
||||||
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
telemetryController?.endRedisSpan(redisSpan)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun exceptionCaught(ex: Throwable) {
|
override fun exceptionCaught(ex: Throwable) {
|
||||||
telemetryController?.endSpan(redisSpan, ex)
|
telemetryController?.endRedisSpan(redisSpan, ex)
|
||||||
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
this@RedisCacheHandler.exceptionCaught(ctx, ex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.woggioni.rbcs.server.redis
|
|||||||
|
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.temporal.ChronoUnit
|
import java.time.temporal.ChronoUnit
|
||||||
|
|
||||||
import net.woggioni.rbcs.api.CacheProvider
|
import net.woggioni.rbcs.api.CacheProvider
|
||||||
import net.woggioni.rbcs.api.exception.ConfigurationException
|
import net.woggioni.rbcs.api.exception.ConfigurationException
|
||||||
import net.woggioni.rbcs.common.HostAndPort
|
import net.woggioni.rbcs.common.HostAndPort
|
||||||
@@ -9,6 +10,7 @@ import net.woggioni.rbcs.common.RBCS
|
|||||||
import net.woggioni.rbcs.common.Xml
|
import net.woggioni.rbcs.common.Xml
|
||||||
import net.woggioni.rbcs.common.Xml.Companion.asIterable
|
import net.woggioni.rbcs.common.Xml.Companion.asIterable
|
||||||
import net.woggioni.rbcs.common.Xml.Companion.renderAttribute
|
import net.woggioni.rbcs.common.Xml.Companion.renderAttribute
|
||||||
|
|
||||||
import org.w3c.dom.Document
|
import org.w3c.dom.Document
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
|||||||
+8
-6
@@ -1,11 +1,5 @@
|
|||||||
package net.woggioni.rbcs.server.redis.client
|
package net.woggioni.rbcs.server.redis.client
|
||||||
|
|
||||||
import java.io.IOException
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.nio.charset.StandardCharsets
|
|
||||||
import java.util.concurrent.CompletableFuture
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
|
||||||
import io.netty.util.concurrent.Future as NettyFuture
|
|
||||||
import io.netty.bootstrap.Bootstrap
|
import io.netty.bootstrap.Bootstrap
|
||||||
import io.netty.buffer.ByteBufAllocator
|
import io.netty.buffer.ByteBufAllocator
|
||||||
import io.netty.buffer.Unpooled
|
import io.netty.buffer.Unpooled
|
||||||
@@ -28,7 +22,15 @@ import io.netty.handler.codec.redis.RedisBulkStringAggregator
|
|||||||
import io.netty.handler.codec.redis.RedisDecoder
|
import io.netty.handler.codec.redis.RedisDecoder
|
||||||
import io.netty.handler.codec.redis.RedisEncoder
|
import io.netty.handler.codec.redis.RedisEncoder
|
||||||
import io.netty.handler.codec.redis.RedisMessage
|
import io.netty.handler.codec.redis.RedisMessage
|
||||||
|
import io.netty.util.concurrent.Future as NettyFuture
|
||||||
import io.netty.util.concurrent.GenericFutureListener
|
import io.netty.util.concurrent.GenericFutureListener
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
import java.net.InetSocketAddress
|
||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
|
||||||
import net.woggioni.rbcs.common.HostAndPort
|
import net.woggioni.rbcs.common.HostAndPort
|
||||||
import net.woggioni.rbcs.common.createLogger
|
import net.woggioni.rbcs.common.createLogger
|
||||||
import net.woggioni.rbcs.common.trace
|
import net.woggioni.rbcs.common.trace
|
||||||
|
|||||||
@@ -1,35 +1,9 @@
|
|||||||
package net.woggioni.rbcs.server
|
package net.woggioni.rbcs.server
|
||||||
|
|
||||||
import java.io.OutputStream
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.Path
|
|
||||||
import java.security.PrivateKey
|
|
||||||
import java.security.cert.X509Certificate
|
|
||||||
import java.time.Duration
|
|
||||||
import java.time.Instant
|
|
||||||
import java.util.Arrays
|
|
||||||
import java.util.Base64
|
|
||||||
import java.util.concurrent.CompletableFuture
|
|
||||||
import java.util.concurrent.Future
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
import java.util.concurrent.TimeoutException
|
|
||||||
import java.util.regex.Matcher
|
|
||||||
import java.util.regex.Pattern
|
|
||||||
import javax.naming.ldap.LdapName
|
|
||||||
import javax.net.ssl.SSLPeerUnverifiedException
|
|
||||||
import io.netty.bootstrap.ServerBootstrap
|
import io.netty.bootstrap.ServerBootstrap
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
import io.netty.channel.Channel
|
import io.netty.channel.*
|
||||||
import io.netty.channel.ChannelFactory
|
|
||||||
import io.netty.channel.ChannelFuture
|
|
||||||
import io.netty.channel.ChannelHandler.Sharable
|
import io.netty.channel.ChannelHandler.Sharable
|
||||||
import io.netty.channel.ChannelHandlerContext
|
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter
|
|
||||||
import io.netty.channel.ChannelInitializer
|
|
||||||
import io.netty.channel.ChannelOption
|
|
||||||
import io.netty.channel.ChannelPromise
|
|
||||||
import io.netty.channel.MultiThreadIoEventLoopGroup
|
|
||||||
import io.netty.channel.nio.NioIoHandler
|
import io.netty.channel.nio.NioIoHandler
|
||||||
import io.netty.channel.socket.DatagramChannel
|
import io.netty.channel.socket.DatagramChannel
|
||||||
import io.netty.channel.socket.ServerSocketChannel
|
import io.netty.channel.socket.ServerSocketChannel
|
||||||
@@ -39,12 +13,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannel
|
|||||||
import io.netty.channel.socket.nio.NioSocketChannel
|
import io.netty.channel.socket.nio.NioSocketChannel
|
||||||
import io.netty.handler.codec.compression.CompressionOptions
|
import io.netty.handler.codec.compression.CompressionOptions
|
||||||
import io.netty.handler.codec.haproxy.HAProxyMessageDecoder
|
import io.netty.handler.codec.haproxy.HAProxyMessageDecoder
|
||||||
import io.netty.handler.codec.http.DefaultHttpContent
|
import io.netty.handler.codec.http.*
|
||||||
import io.netty.handler.codec.http.HttpContentCompressor
|
|
||||||
import io.netty.handler.codec.http.HttpDecoderConfig
|
|
||||||
import io.netty.handler.codec.http.HttpHeaderNames
|
|
||||||
import io.netty.handler.codec.http.HttpRequest
|
|
||||||
import io.netty.handler.codec.http.HttpServerCodec
|
|
||||||
import io.netty.handler.ssl.ClientAuth
|
import io.netty.handler.ssl.ClientAuth
|
||||||
import io.netty.handler.ssl.SslContext
|
import io.netty.handler.ssl.SslContext
|
||||||
import io.netty.handler.ssl.SslContextBuilder
|
import io.netty.handler.ssl.SslContextBuilder
|
||||||
@@ -59,17 +28,13 @@ import net.woggioni.rbcs.api.AsyncCloseable
|
|||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import net.woggioni.rbcs.api.TelemetryController
|
import net.woggioni.rbcs.api.TelemetryController
|
||||||
import net.woggioni.rbcs.api.exception.ConfigurationException
|
import net.woggioni.rbcs.api.exception.ConfigurationException
|
||||||
import net.woggioni.rbcs.common.Cidr
|
import net.woggioni.rbcs.common.*
|
||||||
import net.woggioni.rbcs.common.PasswordSecurity.decodePasswordHash
|
import net.woggioni.rbcs.common.PasswordSecurity.decodePasswordHash
|
||||||
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
||||||
import net.woggioni.rbcs.common.RBCS.getTrustManager
|
import net.woggioni.rbcs.common.RBCS.getTrustManager
|
||||||
import net.woggioni.rbcs.common.RBCS.loadKeystore
|
import net.woggioni.rbcs.common.RBCS.loadKeystore
|
||||||
import net.woggioni.rbcs.common.RBCS.loadService
|
import net.woggioni.rbcs.common.RBCS.loadService
|
||||||
import net.woggioni.rbcs.common.RBCS.toUrl
|
import net.woggioni.rbcs.common.RBCS.toUrl
|
||||||
import net.woggioni.rbcs.common.Xml
|
|
||||||
import net.woggioni.rbcs.common.createLogger
|
|
||||||
import net.woggioni.rbcs.common.debug
|
|
||||||
import net.woggioni.rbcs.common.info
|
|
||||||
import net.woggioni.rbcs.server.auth.AbstractNettyHttpAuthenticator
|
import net.woggioni.rbcs.server.auth.AbstractNettyHttpAuthenticator
|
||||||
import net.woggioni.rbcs.server.auth.Authorizer
|
import net.woggioni.rbcs.server.auth.Authorizer
|
||||||
import net.woggioni.rbcs.server.auth.RoleAuthorizer
|
import net.woggioni.rbcs.server.auth.RoleAuthorizer
|
||||||
@@ -82,6 +47,23 @@ import net.woggioni.rbcs.server.handler.ReadTriggerDuplexHandler
|
|||||||
import net.woggioni.rbcs.server.handler.ServerHandler
|
import net.woggioni.rbcs.server.handler.ServerHandler
|
||||||
import net.woggioni.rbcs.server.throttling.BucketManager
|
import net.woggioni.rbcs.server.throttling.BucketManager
|
||||||
import net.woggioni.rbcs.server.throttling.ThrottlingHandler
|
import net.woggioni.rbcs.server.throttling.ThrottlingHandler
|
||||||
|
import java.io.OutputStream
|
||||||
|
import java.net.InetSocketAddress
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Path
|
||||||
|
import java.security.PrivateKey
|
||||||
|
import java.security.cert.X509Certificate
|
||||||
|
import java.time.Duration
|
||||||
|
import java.time.Instant
|
||||||
|
import java.util.*
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
import java.util.concurrent.Future
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import java.util.concurrent.TimeoutException
|
||||||
|
import java.util.regex.Matcher
|
||||||
|
import java.util.regex.Pattern
|
||||||
|
import javax.naming.ldap.LdapName
|
||||||
|
import javax.net.ssl.SSLPeerUnverifiedException
|
||||||
|
|
||||||
class RemoteBuildCacheServer(private val cfg: Configuration) {
|
class RemoteBuildCacheServer(private val cfg: Configuration) {
|
||||||
|
|
||||||
@@ -188,7 +170,7 @@ class RemoteBuildCacheServer(private val cfg: Configuration) {
|
|||||||
?: return anonymousUserGroups?.let { AuthenticationResult(null, it) }
|
?: return anonymousUserGroups?.let { AuthenticationResult(null, it) }
|
||||||
val ldapName = try {
|
val ldapName = try {
|
||||||
LdapName(subjectDn)
|
LdapName(subjectDn)
|
||||||
} catch (_: Exception) {
|
} catch (e: Exception) {
|
||||||
log.debug(ctx) {
|
log.debug(ctx) {
|
||||||
"Invalid subject DN in header $headerName: $subjectDn"
|
"Invalid subject DN in header $headerName: $subjectDn"
|
||||||
}
|
}
|
||||||
@@ -354,7 +336,7 @@ class RemoteBuildCacheServer(private val cfg: Configuration) {
|
|||||||
}?.let {
|
}?.let {
|
||||||
pattern.matcher(it.value.toString())
|
pattern.matcher(it.value.toString())
|
||||||
}?.takeIf(Matcher::matches)?.group(1)
|
}?.takeIf(Matcher::matches)?.group(1)
|
||||||
cfg.users[userName] ?: throw RuntimeException("Failed to extract user")
|
cfg.users[userName] ?: throw java.lang.RuntimeException("Failed to extract user")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,7 +350,7 @@ class RemoteBuildCacheServer(private val cfg: Configuration) {
|
|||||||
}?.let {
|
}?.let {
|
||||||
pattern.matcher(it.value.toString())
|
pattern.matcher(it.value.toString())
|
||||||
}?.takeIf(Matcher::matches)?.group(1)
|
}?.takeIf(Matcher::matches)?.group(1)
|
||||||
cfg.groups[groupName] ?: throw RuntimeException("Failed to extract group")
|
cfg.groups[groupName] ?: throw java.lang.RuntimeException("Failed to extract group")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.woggioni.rbcs.server.auth
|
package net.woggioni.rbcs.server.auth
|
||||||
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import io.netty.buffer.Unpooled
|
import io.netty.buffer.Unpooled
|
||||||
import io.netty.channel.ChannelFutureListener
|
import io.netty.channel.ChannelFutureListener
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
@@ -13,11 +12,11 @@ import io.netty.handler.codec.http.HttpRequest
|
|||||||
import io.netty.handler.codec.http.HttpResponseStatus
|
import io.netty.handler.codec.http.HttpResponseStatus
|
||||||
import io.netty.handler.codec.http.HttpVersion
|
import io.netty.handler.codec.http.HttpVersion
|
||||||
import io.netty.util.ReferenceCountUtil
|
import io.netty.util.ReferenceCountUtil
|
||||||
|
import java.net.InetSocketAddress
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import net.woggioni.rbcs.api.Configuration.Group
|
import net.woggioni.rbcs.api.Configuration.Group
|
||||||
import net.woggioni.rbcs.api.Role
|
import net.woggioni.rbcs.api.Role
|
||||||
import net.woggioni.rbcs.common.createLogger
|
import net.woggioni.rbcs.common.createLogger
|
||||||
import net.woggioni.rbcs.common.debug
|
|
||||||
import net.woggioni.rbcs.server.RemoteBuildCacheServer
|
import net.woggioni.rbcs.server.RemoteBuildCacheServer
|
||||||
|
|
||||||
abstract class AbstractNettyHttpAuthenticator(private val authorizer: Authorizer) : ChannelInboundHandlerAdapter() {
|
abstract class AbstractNettyHttpAuthenticator(private val authorizer: Authorizer) : ChannelInboundHandlerAdapter() {
|
||||||
@@ -57,17 +56,15 @@ abstract class AbstractNettyHttpAuthenticator(private val authorizer: Authorizer
|
|||||||
result.groups.asSequence().flatMap { it.roles.asSequence() }
|
result.groups.asSequence().flatMap { it.roles.asSequence() }
|
||||||
).toSet()
|
).toSet()
|
||||||
val authorized = authorizer.authorize(roles, msg)
|
val authorized = authorizer.authorize(roles, msg)
|
||||||
log.debug {
|
if(log.isDebugEnabled) {
|
||||||
val authorizedMessage = if (authorized) {
|
val authorizedMessage = if(authorized) { "Authorized" } else { "Forbidden" }
|
||||||
"Authorized"
|
val clientAddress = ctx.channel().attr<InetSocketAddress>(RemoteBuildCacheServer.clientIp).get()
|
||||||
} else {
|
val roleString = "[" + roles.asSequence().map { "\"" + it + "\""}.joinToString(", ") + "]"
|
||||||
"Forbidden"
|
|
||||||
}
|
|
||||||
val clientAddress = ctx.channel().attr(RemoteBuildCacheServer.clientIp).get()
|
|
||||||
val roleString = "[" + roles.asSequence().map { "\"" + it + "\"" }.joinToString(", ") + "]"
|
|
||||||
result.user?.name?.takeUnless(String::isEmpty)?.let { username ->
|
result.user?.name?.takeUnless(String::isEmpty)?.let { username ->
|
||||||
"$authorizedMessage ${msg.method()} request from user $username with address $clientAddress, granted roles $roleString"
|
log.debug("$authorizedMessage ${msg.method()} request from user $username with address $clientAddress, granted roles $roleString")
|
||||||
} ?: "$authorizedMessage anonymous ${msg.method()} request with address $clientAddress, granted roles $roleString"
|
} ?: {
|
||||||
|
log.debug("$authorizedMessage anonymous ${msg.method()} request with address $clientAddress, granted roles $roleString")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (authorized) {
|
if (authorized) {
|
||||||
super.channelRead(ctx, msg)
|
super.channelRead(ctx, msg)
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
package net.woggioni.rbcs.server.cache
|
package net.woggioni.rbcs.server.cache
|
||||||
|
|
||||||
import java.nio.file.Path
|
|
||||||
import java.time.Duration
|
|
||||||
import io.netty.channel.ChannelFactory
|
import io.netty.channel.ChannelFactory
|
||||||
import io.netty.channel.EventLoopGroup
|
import io.netty.channel.EventLoopGroup
|
||||||
import io.netty.channel.socket.DatagramChannel
|
import io.netty.channel.socket.DatagramChannel
|
||||||
import io.netty.channel.socket.SocketChannel
|
import io.netty.channel.socket.SocketChannel
|
||||||
|
import java.nio.file.Path
|
||||||
|
import java.time.Duration
|
||||||
import net.woggioni.jwo.Application
|
import net.woggioni.jwo.Application
|
||||||
import net.woggioni.rbcs.api.CacheHandlerFactory
|
import net.woggioni.rbcs.api.CacheHandlerFactory
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
|
|||||||
+4
-4
@@ -1,14 +1,14 @@
|
|||||||
package net.woggioni.rbcs.server.cache
|
package net.woggioni.rbcs.server.cache
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf
|
||||||
|
import io.netty.channel.ChannelHandlerContext
|
||||||
|
import io.netty.handler.codec.http.LastHttpContent
|
||||||
|
import io.netty.handler.stream.ChunkedNioFile
|
||||||
import java.nio.channels.Channels
|
import java.nio.channels.Channels
|
||||||
import java.util.Base64
|
import java.util.Base64
|
||||||
import java.util.zip.Deflater
|
import java.util.zip.Deflater
|
||||||
import java.util.zip.DeflaterOutputStream
|
import java.util.zip.DeflaterOutputStream
|
||||||
import java.util.zip.InflaterInputStream
|
import java.util.zip.InflaterInputStream
|
||||||
import io.netty.buffer.ByteBuf
|
|
||||||
import io.netty.channel.ChannelHandlerContext
|
|
||||||
import io.netty.handler.codec.http.LastHttpContent
|
|
||||||
import io.netty.handler.stream.ChunkedNioFile
|
|
||||||
import net.woggioni.rbcs.api.CacheHandler
|
import net.woggioni.rbcs.api.CacheHandler
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage
|
import net.woggioni.rbcs.api.message.CacheMessage
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage.CacheContent
|
import net.woggioni.rbcs.api.message.CacheMessage.CacheContent
|
||||||
|
|||||||
+1
-1
@@ -1,10 +1,10 @@
|
|||||||
package net.woggioni.rbcs.server.cache
|
package net.woggioni.rbcs.server.cache
|
||||||
|
|
||||||
import java.time.Duration
|
|
||||||
import io.netty.channel.ChannelFactory
|
import io.netty.channel.ChannelFactory
|
||||||
import io.netty.channel.EventLoopGroup
|
import io.netty.channel.EventLoopGroup
|
||||||
import io.netty.channel.socket.DatagramChannel
|
import io.netty.channel.socket.DatagramChannel
|
||||||
import io.netty.channel.socket.SocketChannel
|
import io.netty.channel.socket.SocketChannel
|
||||||
|
import java.time.Duration
|
||||||
import net.woggioni.rbcs.api.CacheHandlerFactory
|
import net.woggioni.rbcs.api.CacheHandlerFactory
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import net.woggioni.rbcs.common.RBCS
|
import net.woggioni.rbcs.common.RBCS
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
package net.woggioni.rbcs.server.cache
|
package net.woggioni.rbcs.server.cache
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf
|
||||||
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import java.util.zip.Deflater
|
import java.util.zip.Deflater
|
||||||
import java.util.zip.DeflaterOutputStream
|
import java.util.zip.DeflaterOutputStream
|
||||||
import java.util.zip.InflaterOutputStream
|
import java.util.zip.InflaterOutputStream
|
||||||
import io.netty.buffer.ByteBuf
|
|
||||||
import io.netty.channel.ChannelHandlerContext
|
|
||||||
import net.woggioni.rbcs.api.CacheHandler
|
import net.woggioni.rbcs.api.CacheHandler
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage
|
import net.woggioni.rbcs.api.message.CacheMessage
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage.CacheContent
|
import net.woggioni.rbcs.api.message.CacheMessage.CacheContent
|
||||||
|
|||||||
@@ -344,14 +344,14 @@ object Parser {
|
|||||||
roles = parseRoles(child)
|
roles = parseRoles(child)
|
||||||
}
|
}
|
||||||
"group-quota" -> {
|
"group-quota" -> {
|
||||||
groupQuota = parseQuota(child)
|
userQuota = parseQuota(child)
|
||||||
}
|
}
|
||||||
"user-quota" -> {
|
"user-quota" -> {
|
||||||
userQuota = parseQuota(child)
|
groupQuota = parseQuota(child)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
groupName to Group(groupName, roles, groupQuota, userQuota)
|
groupName to Group(groupName, roles, userQuota, groupQuota)
|
||||||
}.toMap()
|
}.toMap()
|
||||||
val users = knownUsersMap.map { (name, user) ->
|
val users = knownUsersMap.map { (name, user) ->
|
||||||
name to User(name, user.password, userGroups[name]?.mapNotNull { groups[it] }?.toSet() ?: emptySet(), user.quota)
|
name to User(name, user.password, userGroups[name]?.mapNotNull { groups[it] }?.toSet() ?: emptySet(), user.quota)
|
||||||
|
|||||||
+26
-11
@@ -1,9 +1,5 @@
|
|||||||
package net.woggioni.rbcs.server.exception
|
package net.woggioni.rbcs.server.exception
|
||||||
|
|
||||||
import java.net.ConnectException
|
|
||||||
import java.net.SocketException
|
|
||||||
import javax.net.ssl.SSLException
|
|
||||||
import javax.net.ssl.SSLPeerUnverifiedException
|
|
||||||
import io.netty.buffer.Unpooled
|
import io.netty.buffer.Unpooled
|
||||||
import io.netty.channel.ChannelDuplexHandler
|
import io.netty.channel.ChannelDuplexHandler
|
||||||
import io.netty.channel.ChannelFutureListener
|
import io.netty.channel.ChannelFutureListener
|
||||||
@@ -17,11 +13,16 @@ import io.netty.handler.codec.http.HttpResponseStatus
|
|||||||
import io.netty.handler.codec.http.HttpVersion
|
import io.netty.handler.codec.http.HttpVersion
|
||||||
import io.netty.handler.timeout.ReadTimeoutException
|
import io.netty.handler.timeout.ReadTimeoutException
|
||||||
import io.netty.handler.timeout.WriteTimeoutException
|
import io.netty.handler.timeout.WriteTimeoutException
|
||||||
|
import java.net.ConnectException
|
||||||
|
import java.net.SocketException
|
||||||
|
import javax.net.ssl.SSLException
|
||||||
|
import javax.net.ssl.SSLPeerUnverifiedException
|
||||||
import net.woggioni.rbcs.api.exception.CacheException
|
import net.woggioni.rbcs.api.exception.CacheException
|
||||||
import net.woggioni.rbcs.api.exception.ContentTooLargeException
|
import net.woggioni.rbcs.api.exception.ContentTooLargeException
|
||||||
import net.woggioni.rbcs.common.contextLogger
|
import net.woggioni.rbcs.common.contextLogger
|
||||||
import net.woggioni.rbcs.common.debug
|
import net.woggioni.rbcs.common.debug
|
||||||
import net.woggioni.rbcs.common.log
|
import net.woggioni.rbcs.common.log
|
||||||
|
import net.woggioni.rbcs.server.RemoteBuildCacheServer
|
||||||
import org.slf4j.event.Level
|
import org.slf4j.event.Level
|
||||||
import org.slf4j.spi.LoggingEventBuilder
|
import org.slf4j.spi.LoggingEventBuilder
|
||||||
|
|
||||||
@@ -59,28 +60,38 @@ object ExceptionHandler : ChannelDuplexHandler() {
|
|||||||
override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) {
|
override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) {
|
||||||
when (cause) {
|
when (cause) {
|
||||||
is DecoderException -> {
|
is DecoderException -> {
|
||||||
log.debug(cause.message, cause)
|
if(log.isDebugEnabled) {
|
||||||
|
log.debug(cause.message, cause)
|
||||||
|
}
|
||||||
ctx.close()
|
ctx.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
is ConnectException -> {
|
is ConnectException -> {
|
||||||
log.error(cause.message, cause)
|
if(log.isErrorEnabled) {
|
||||||
|
log.error(cause.message, cause)
|
||||||
|
}
|
||||||
ctx.writeAndFlush(SERVER_ERROR.retainedDuplicate())
|
ctx.writeAndFlush(SERVER_ERROR.retainedDuplicate())
|
||||||
}
|
}
|
||||||
|
|
||||||
is SocketException -> {
|
is SocketException -> {
|
||||||
log.debug(cause.message, cause)
|
if(log.isDebugEnabled) {
|
||||||
|
log.debug(cause.message, cause)
|
||||||
|
}
|
||||||
ctx.close()
|
ctx.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
is SSLPeerUnverifiedException -> {
|
is SSLPeerUnverifiedException -> {
|
||||||
log.debug(cause.message, cause)
|
if(log.isDebugEnabled) {
|
||||||
|
log.debug(cause.message, cause)
|
||||||
|
}
|
||||||
ctx.writeAndFlush(NOT_AUTHORIZED.retainedDuplicate())
|
ctx.writeAndFlush(NOT_AUTHORIZED.retainedDuplicate())
|
||||||
.addListener(ChannelFutureListener.CLOSE_ON_FAILURE)
|
.addListener(ChannelFutureListener.CLOSE_ON_FAILURE)
|
||||||
}
|
}
|
||||||
|
|
||||||
is SSLException -> {
|
is SSLException -> {
|
||||||
log.debug(cause.message, cause)
|
if(log.isDebugEnabled) {
|
||||||
|
log.debug(cause.message, cause)
|
||||||
|
}
|
||||||
ctx.close()
|
ctx.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,13 +120,17 @@ object ExceptionHandler : ChannelDuplexHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is CacheException -> {
|
is CacheException -> {
|
||||||
log.error(cause.message, cause)
|
if(log.isErrorEnabled) {
|
||||||
|
log.error(cause.message, cause)
|
||||||
|
}
|
||||||
ctx.writeAndFlush(NOT_AVAILABLE.retainedDuplicate())
|
ctx.writeAndFlush(NOT_AVAILABLE.retainedDuplicate())
|
||||||
.addListener(ChannelFutureListener.CLOSE_ON_FAILURE)
|
.addListener(ChannelFutureListener.CLOSE_ON_FAILURE)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
log.error(cause.message, cause)
|
if(log.isErrorEnabled) {
|
||||||
|
log.error(cause.message, cause)
|
||||||
|
}
|
||||||
ctx.writeAndFlush(SERVER_ERROR.retainedDuplicate())
|
ctx.writeAndFlush(SERVER_ERROR.retainedDuplicate())
|
||||||
.addListener(ChannelFutureListener.CLOSE_ON_FAILURE)
|
.addListener(ChannelFutureListener.CLOSE_ON_FAILURE)
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-8
@@ -1,10 +1,10 @@
|
|||||||
package net.woggioni.rbcs.server.handler
|
package net.woggioni.rbcs.server.handler
|
||||||
|
|
||||||
import java.net.InetAddress
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import io.netty.channel.SimpleChannelInboundHandler
|
import io.netty.channel.SimpleChannelInboundHandler
|
||||||
import io.netty.handler.codec.haproxy.HAProxyMessage
|
import io.netty.handler.codec.haproxy.HAProxyMessage
|
||||||
|
import java.net.InetAddress
|
||||||
|
import java.net.InetSocketAddress
|
||||||
import net.woggioni.rbcs.common.Cidr
|
import net.woggioni.rbcs.common.Cidr
|
||||||
import net.woggioni.rbcs.common.createLogger
|
import net.woggioni.rbcs.common.createLogger
|
||||||
import net.woggioni.rbcs.common.trace
|
import net.woggioni.rbcs.common.trace
|
||||||
@@ -23,21 +23,23 @@ class ProxyProtocolHandler(private val trustedProxyIPs : List<Cidr>) : SimpleCha
|
|||||||
) {
|
) {
|
||||||
val sourceAddress = ctx.channel().remoteAddress()
|
val sourceAddress = ctx.channel().remoteAddress()
|
||||||
if (sourceAddress is InetSocketAddress &&
|
if (sourceAddress is InetSocketAddress &&
|
||||||
(trustedProxyIPs.isEmpty() ||
|
trustedProxyIPs.isEmpty() ||
|
||||||
trustedProxyIPs.any { it.contains(sourceAddress.address) }.also {
|
trustedProxyIPs.any { it.contains((sourceAddress as InetSocketAddress).address) }.also {
|
||||||
if(!it) {
|
if(!it && log.isTraceEnabled) {
|
||||||
log.trace {
|
log.trace {
|
||||||
"Received a proxied connection request from $sourceAddress which is not a trusted proxy address, " +
|
"Received a proxied connection request from $sourceAddress which is not a trusted proxy address, " +
|
||||||
"the proxy server address will be used instead"
|
"the proxy server address will be used instead"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})) {
|
}) {
|
||||||
val proxiedClientAddress = InetSocketAddress(
|
val proxiedClientAddress = InetSocketAddress(
|
||||||
InetAddress.ofLiteral(msg.sourceAddress()),
|
InetAddress.ofLiteral(msg.sourceAddress()),
|
||||||
msg.sourcePort()
|
msg.sourcePort()
|
||||||
)
|
)
|
||||||
log.trace {
|
if(log.isTraceEnabled) {
|
||||||
"Received proxied connection request from $sourceAddress forwarded for $proxiedClientAddress"
|
log.trace {
|
||||||
|
"Received proxied connection request from $sourceAddress forwarded for $proxiedClientAddress"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ctx.channel().attr(RemoteBuildCacheServer.clientIp).set(proxiedClientAddress)
|
ctx.channel().attr(RemoteBuildCacheServer.clientIp).set(proxiedClientAddress)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.woggioni.rbcs.server.handler
|
package net.woggioni.rbcs.server.handler
|
||||||
|
|
||||||
import java.nio.file.Path
|
|
||||||
import io.netty.channel.ChannelDuplexHandler
|
import io.netty.channel.ChannelDuplexHandler
|
||||||
import io.netty.channel.ChannelHandler
|
import io.netty.channel.ChannelHandler
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
@@ -19,6 +18,7 @@ import io.netty.handler.codec.http.HttpResponseStatus
|
|||||||
import io.netty.handler.codec.http.HttpUtil
|
import io.netty.handler.codec.http.HttpUtil
|
||||||
import io.netty.handler.codec.http.HttpVersion
|
import io.netty.handler.codec.http.HttpVersion
|
||||||
import io.netty.handler.codec.http.LastHttpContent
|
import io.netty.handler.codec.http.LastHttpContent
|
||||||
|
import java.nio.file.Path
|
||||||
import net.woggioni.rbcs.api.CacheValueMetadata
|
import net.woggioni.rbcs.api.CacheValueMetadata
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage
|
import net.woggioni.rbcs.api.message.CacheMessage
|
||||||
import net.woggioni.rbcs.api.message.CacheMessage.CacheContent
|
import net.woggioni.rbcs.api.message.CacheMessage.CacheContent
|
||||||
@@ -171,6 +171,7 @@ class ServerHandler(private val serverPrefix: Path, private val cacheHandlerSupp
|
|||||||
ctx.pipeline().addBefore(ExceptionHandler.NAME, null, cacheHandler)
|
ctx.pipeline().addBefore(ExceptionHandler.NAME, null, cacheHandler)
|
||||||
key.let(::CacheGetRequest)
|
key.let(::CacheGetRequest)
|
||||||
.let(ctx::fireChannelRead)
|
.let(ctx::fireChannelRead)
|
||||||
|
?: ctx.channel().write(CacheValueNotFoundResponse(key))
|
||||||
} else {
|
} else {
|
||||||
cacheRequestInProgress = false
|
cacheRequestInProgress = false
|
||||||
log.warn(ctx) {
|
log.warn(ctx) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.woggioni.rbcs.server.handler
|
package net.woggioni.rbcs.server.handler
|
||||||
|
|
||||||
import java.nio.file.Path
|
|
||||||
import io.netty.channel.ChannelHandler.Sharable
|
import io.netty.channel.ChannelHandler.Sharable
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter
|
import io.netty.channel.ChannelInboundHandlerAdapter
|
||||||
@@ -11,6 +10,7 @@ import io.netty.handler.codec.http.HttpHeaderValues
|
|||||||
import io.netty.handler.codec.http.HttpRequest
|
import io.netty.handler.codec.http.HttpRequest
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus
|
import io.netty.handler.codec.http.HttpResponseStatus
|
||||||
import io.netty.handler.codec.http.LastHttpContent
|
import io.netty.handler.codec.http.LastHttpContent
|
||||||
|
import java.nio.file.Path
|
||||||
|
|
||||||
@Sharable
|
@Sharable
|
||||||
object TraceHandler : ChannelInboundHandlerAdapter() {
|
object TraceHandler : ChannelInboundHandlerAdapter() {
|
||||||
|
|||||||
+5
-5
@@ -1,10 +1,5 @@
|
|||||||
package net.woggioni.rbcs.server.throttling
|
package net.woggioni.rbcs.server.throttling
|
||||||
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.time.Duration
|
|
||||||
import java.time.temporal.ChronoUnit
|
|
||||||
import java.util.ArrayDeque
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
import io.netty.buffer.ByteBufHolder
|
import io.netty.buffer.ByteBufHolder
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter
|
import io.netty.channel.ChannelInboundHandlerAdapter
|
||||||
@@ -15,6 +10,11 @@ import io.netty.handler.codec.http.HttpRequest
|
|||||||
import io.netty.handler.codec.http.HttpResponseStatus
|
import io.netty.handler.codec.http.HttpResponseStatus
|
||||||
import io.netty.handler.codec.http.HttpVersion
|
import io.netty.handler.codec.http.HttpVersion
|
||||||
import io.netty.handler.codec.http.LastHttpContent
|
import io.netty.handler.codec.http.LastHttpContent
|
||||||
|
import java.net.InetSocketAddress
|
||||||
|
import java.time.Duration
|
||||||
|
import java.time.temporal.ChronoUnit
|
||||||
|
import java.util.ArrayDeque
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
import net.woggioni.jwo.Bucket
|
import net.woggioni.jwo.Bucket
|
||||||
import net.woggioni.jwo.LongMath
|
import net.woggioni.jwo.LongMath
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package net.woggioni.rbcs.server.test
|
package net.woggioni.rbcs.server.test
|
||||||
|
|
||||||
|
import io.netty.handler.codec.http.HttpResponseStatus
|
||||||
import java.net.http.HttpClient
|
import java.net.http.HttpClient
|
||||||
import java.net.http.HttpRequest
|
import java.net.http.HttpRequest
|
||||||
import java.net.http.HttpResponse
|
import java.net.http.HttpResponse
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.temporal.ChronoUnit
|
import java.time.temporal.ChronoUnit
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus
|
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import net.woggioni.rbcs.api.Role
|
import net.woggioni.rbcs.api.Role
|
||||||
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
||||||
|
|||||||
+1
-1
@@ -1,9 +1,9 @@
|
|||||||
package net.woggioni.rbcs.server.test
|
package net.woggioni.rbcs.server.test
|
||||||
|
|
||||||
|
import io.netty.handler.codec.http.HttpResponseStatus
|
||||||
import java.net.http.HttpClient
|
import java.net.http.HttpClient
|
||||||
import java.net.http.HttpRequest
|
import java.net.http.HttpRequest
|
||||||
import java.net.http.HttpResponse
|
import java.net.http.HttpResponse
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus
|
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
||||||
import org.junit.jupiter.api.Assertions
|
import org.junit.jupiter.api.Assertions
|
||||||
|
|||||||
+1
-1
@@ -1,9 +1,9 @@
|
|||||||
package net.woggioni.rbcs.server.test
|
package net.woggioni.rbcs.server.test
|
||||||
|
|
||||||
|
import io.netty.handler.codec.http.HttpResponseStatus
|
||||||
import java.net.http.HttpClient
|
import java.net.http.HttpClient
|
||||||
import java.net.http.HttpRequest
|
import java.net.http.HttpRequest
|
||||||
import java.net.http.HttpResponse
|
import java.net.http.HttpResponse
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus
|
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import org.junit.jupiter.api.Assertions
|
import org.junit.jupiter.api.Assertions
|
||||||
import org.junit.jupiter.api.Order
|
import org.junit.jupiter.api.Order
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.woggioni.rbcs.server.test
|
package net.woggioni.rbcs.server.test
|
||||||
|
|
||||||
|
import io.netty.handler.codec.http.HttpResponseStatus
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.net.http.HttpClient
|
import java.net.http.HttpClient
|
||||||
import java.net.http.HttpRequest
|
import java.net.http.HttpRequest
|
||||||
@@ -10,7 +11,6 @@ import java.time.temporal.ChronoUnit
|
|||||||
import java.util.Base64
|
import java.util.Base64
|
||||||
import java.util.zip.Deflater
|
import java.util.zip.Deflater
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus
|
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import net.woggioni.rbcs.common.RBCS.getFreePort
|
import net.woggioni.rbcs.common.RBCS.getFreePort
|
||||||
import net.woggioni.rbcs.common.Xml
|
import net.woggioni.rbcs.common.Xml
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package net.woggioni.rbcs.server.test
|
package net.woggioni.rbcs.server.test
|
||||||
|
|
||||||
|
import io.netty.handler.codec.http.HttpResponseStatus
|
||||||
import java.net.http.HttpClient
|
import java.net.http.HttpClient
|
||||||
import java.net.http.HttpRequest
|
import java.net.http.HttpRequest
|
||||||
import java.net.http.HttpResponse
|
import java.net.http.HttpResponse
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus
|
|
||||||
import net.woggioni.rbcs.api.Configuration
|
import net.woggioni.rbcs.api.Configuration
|
||||||
import net.woggioni.rbcs.api.Role
|
import net.woggioni.rbcs.api.Role
|
||||||
import org.bouncycastle.asn1.x500.X500Name
|
import org.bouncycastle.asn1.x500.X500Name
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
package net.woggioni.rbcs.servlet
|
package net.woggioni.rbcs.servlet
|
||||||
|
|
||||||
|
import jakarta.annotation.PreDestroy
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped
|
||||||
|
import jakarta.inject.Inject
|
||||||
|
import jakarta.servlet.annotation.WebServlet
|
||||||
|
import jakarta.servlet.http.HttpServlet
|
||||||
|
import jakarta.servlet.http.HttpServletRequest
|
||||||
|
import jakarta.servlet.http.HttpServletResponse
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
@@ -10,13 +17,6 @@ import java.util.concurrent.PriorityBlockingQueue
|
|||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
import jakarta.annotation.PreDestroy
|
|
||||||
import jakarta.enterprise.context.ApplicationScoped
|
|
||||||
import jakarta.inject.Inject
|
|
||||||
import jakarta.servlet.annotation.WebServlet
|
|
||||||
import jakarta.servlet.http.HttpServlet
|
|
||||||
import jakarta.servlet.http.HttpServletRequest
|
|
||||||
import jakarta.servlet.http.HttpServletResponse
|
|
||||||
import net.woggioni.jwo.HttpClient.HttpStatus
|
import net.woggioni.jwo.HttpClient.HttpStatus
|
||||||
import net.woggioni.jwo.JWO
|
import net.woggioni.jwo.JWO
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
// mavenLocal {
|
|
||||||
// content {
|
|
||||||
// includeGroup 'net.woggioni.gradle'
|
|
||||||
// includeGroup 'net.woggioni.gradle.lombok'
|
|
||||||
// includeGroup 'net.woggioni.gradle.finalguard'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
maven {
|
maven {
|
||||||
url = getProperty('gitea.maven.url')
|
url = getProperty('gitea.maven.url')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user