-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some Improvements to intelliJ extension (#641)
* same default options as CLI * improved UI layouts * fixed not reappearing window after pressing cancel-button * separate tcp and udp outgoing option * allow only single selection for namespaces and pods * refactor UI-creating code to a more Kotlin functional style Co-authored-by: Mehul <[email protected]>
- Loading branch information
1 parent
b6bb855
commit 1022bd5
Showing
6 changed files
with
181 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
intellij-ext/src/main/kotlin/com/metalbear/mirrord/LogLevel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.metalbear.mirrord | ||
|
||
enum class LogLevel { | ||
ERROR, WARN, INFO, DEBUG, TRACE; | ||
} |
38 changes: 38 additions & 0 deletions
38
intellij-ext/src/main/kotlin/com/metalbear/mirrord/MirrordDefaultConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.metalbear.mirrord | ||
|
||
import com.intellij.openapi.application.PathManager | ||
import java.nio.file.Paths | ||
|
||
data class MirrordDefaultConfig( | ||
val ldPreloadPath: String = getSharedLibPath("libmirrord_layer.so"), | ||
val dylibPath: String = getSharedLibPath("libmirrord_layer.dylib"), | ||
val acceptInvalidCertificates: Boolean = true, | ||
val skipProcesses: String = "", | ||
val fileOps: Boolean = true, | ||
val stealTraffic: Boolean = true, | ||
val telemetry: Boolean = true, | ||
val ephemeralContainers: Boolean = false, | ||
val remoteDns: Boolean = false, | ||
val tcpOutgoingTraffic: Boolean = false, | ||
val udpOutgoingTraffic: Boolean = false, | ||
val agentRustLog: LogLevel = LogLevel.INFO, | ||
val rustLog: LogLevel = LogLevel.INFO, | ||
val overrideEnvVarsExclude: String = "", | ||
val overrideEnvVarsInclude: String = "*", | ||
) | ||
|
||
private fun getSharedLibPath(libName: String): String { | ||
val path = Paths.get(PathManager.getPluginsPath(), "mirrord", libName).toString() | ||
|
||
if (System.getProperty("os.name").toLowerCase().contains("win")) { | ||
val wslRegex = "^[a-zA-Z]:".toRegex() | ||
|
||
val wslPath = wslRegex.replace(path) { drive -> | ||
"/mnt/" + drive.value.toLowerCase().removeSuffix(":") | ||
} | ||
|
||
return wslPath.replace("\\", "/") | ||
} | ||
|
||
return path | ||
} |
24 changes: 0 additions & 24 deletions
24
intellij-ext/src/main/kotlin/com/metalbear/mirrord/MirrordDefaultData.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.