Skip to content

Commit

Permalink
ポート開放完成・・・?
Browse files Browse the repository at this point in the history
  • Loading branch information
Naotiki committed Jun 11, 2022
1 parent 33985bb commit 7137e34
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 7 deletions.
23 changes: 23 additions & 0 deletions .idea/remote-targets.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions How To Use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# インストール
Releaseにzipファイルがあるので自分のOSにあったものをダウンロードし、任意の場所で回答してください。

JREが同梱されているのでJavaのインストールは不要です
# 使い方
`cd bin`

`./mstools <引数> <オプション>`
とすることで使えます
```text
debug デバッグ用 通常は使いません
network <mode> 質問形式でネットワークの設定を変更します
mode:[open,close]
open ポートを開きます
close ポートを閉じます
```
13 changes: 12 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,21 @@ tasks.jar {
}

runtime {
options.set( listOf("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages"))

additive.set(true)
jpackage {
val currentOs = org.gradle.internal.os.OperatingSystem.current()
// skipInstaller=true

imageName="mstools"
mainClass="MainKt"
when{
currentOs.isWindows->{
imageOptions = listOf("--win-console")
}
currentOs.isLinux->{

}
}
}
}
20 changes: 14 additions & 6 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ fun main(args: Array<String>) {

class Network : Subcommand("network", "ネットワークの設定をするます") {

val mode by argument(ArgType.Choice<NetworkMode>(), "モード")

val mode by argument(ArgType.Choice<NetworkMode>(), "mode")


var ipv4 by option(ArgType.String, "ipv4", "i", "ぶち開けるipv4アドレスを指定します")
Expand Down Expand Up @@ -131,7 +130,11 @@ fun main(args: Array<String>) {
print("Enterで続行 変更する場合は右にIPv4アドレスを入力:")
ipv4 = readlnOrNull()?.ifEmpty { null } ?: ipv4
println("IPv4アドレス $ipv4 で続行します")
val (TCPPorts, UDPPorts) = getPorts() ?: run { return }
val (TCPPorts, UDPPorts) = getPorts() ?: run {
cp.stop()
cp.terminate()
return
}

println("UPnPのNAT設定してぶち開けるます")
Logger.setLogLevel(Logger.VERBOSE)
Expand Down Expand Up @@ -183,7 +186,11 @@ fun main(args: Array<String>) {
}
Close -> {
println("閉じます")
val (TCPPorts, UDPPorts) = getPorts() ?: run { return }
val (TCPPorts, UDPPorts) = getPorts() ?: run {
cp.stop()
cp.terminate()
return
}
println("対応デバイスを検索中")
cp.search("urn:schemas-upnp-org:service:WANPPPConnection:1")
while (supportedDevices.isEmpty()) {
Expand Down Expand Up @@ -220,8 +227,9 @@ fun main(args: Array<String>) {
}
else -> {}
}


println("Clean Up")
cp.stop()
cp.terminate()
}
mode == DDNS -> TODO()
mode == Check -> TODO()
Expand Down

0 comments on commit 7137e34

Please sign in to comment.