Testing search query
This commit is contained in:
parent
8256d6a681
commit
7abe904997
@ -49,23 +49,11 @@ public class IpScanner
|
|||||||
threadsAmount = 256 / threads;
|
threadsAmount = 256 / threads;
|
||||||
}
|
}
|
||||||
|
|
||||||
WaitHandle[] waitHandle1;
|
WaitHandle[] waitHandle = new WaitHandle[64];
|
||||||
WaitHandle[] waitHandle2;
|
|
||||||
|
|
||||||
// This is jank. But it was to get it production ready.
|
|
||||||
if (threads <= 64)
|
|
||||||
{
|
|
||||||
waitHandle1 = new WaitHandle[threads];
|
|
||||||
waitHandle2 = new WaitHandle[threads];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
waitHandle1 = new WaitHandle[64];
|
|
||||||
waitHandle2 = new WaitHandle[64];
|
|
||||||
}
|
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
int counter2 = 0;
|
|
||||||
|
List<WaitHandle[]> waitHandles = [];
|
||||||
|
|
||||||
for (int i = 0; i < threads; i++)
|
for (int i = 0; i < threads; i++)
|
||||||
{
|
{
|
||||||
@ -79,31 +67,26 @@ public class IpScanner
|
|||||||
Handle = handle
|
Handle = handle
|
||||||
};
|
};
|
||||||
|
|
||||||
if (i < 64)
|
if (counter < 64)
|
||||||
{
|
{
|
||||||
waitHandle1[counter] = handle;
|
waitHandle[counter] = handle;
|
||||||
counter++;
|
counter++;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
waitHandle2[counter2] = handle;
|
|
||||||
counter2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread f = new (Scan!);
|
Thread f = new (Scan!);
|
||||||
f.Start(scanSettings);
|
f.Start(scanSettings);
|
||||||
|
|
||||||
Console.WriteLine($"Scanner thread ({i}) started");
|
Console.WriteLine($"Scanner thread ({i}) started");
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WaitHandle[]> waitHandles = new();
|
counter = 0;
|
||||||
|
|
||||||
Console.WriteLine("Waithandle 1 count = " + waitHandle1.Length);
|
waitHandles.Add(waitHandle);
|
||||||
Console.WriteLine("Waithandle 2 count = " + waitHandle2.Length);
|
|
||||||
|
|
||||||
waitHandles.Add(waitHandle1);
|
waitHandle = new WaitHandle[64];
|
||||||
waitHandles.Add(waitHandle2);
|
}
|
||||||
|
|
||||||
return waitHandles;
|
return waitHandles;
|
||||||
}
|
}
|
||||||
@ -183,7 +166,8 @@ public class IpScanner
|
|||||||
_ = IPAddress.TryParse(ip.ToString(), out IPAddress? address);
|
_ = IPAddress.TryParse(ip.ToString(), out IPAddress? address);
|
||||||
if (address is not null)
|
if (address is not null)
|
||||||
{
|
{
|
||||||
responseCode = ping.Send(address, _timeout, buf, null).Status;
|
responseCode = IPStatus.TimedOut; //ping.Send(address, _timeout, buf, null).Status;
|
||||||
|
Thread.Sleep(_timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -59,7 +59,7 @@ public class ThreadHandler
|
|||||||
{
|
{
|
||||||
Thread.Sleep(5000); // Let the database handler instantiate and warm up first.
|
Thread.Sleep(5000); // Let the database handler instantiate and warm up first.
|
||||||
|
|
||||||
List<WaitHandle[]> wait = _ipScanner.Start(128);
|
List<WaitHandle[]> wait = _ipScanner.Start(256);
|
||||||
|
|
||||||
for (int i = 0; i < wait.Count; i++)
|
for (int i = 0; i < wait.Count; i++)
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ public class ThreadHandler
|
|||||||
|
|
||||||
private void StartDiscardedDbHandler()
|
private void StartDiscardedDbHandler()
|
||||||
{
|
{
|
||||||
WaitHandle[] wait = _dbHandler.Start(4);
|
WaitHandle[] wait = _dbHandler.Start(5);
|
||||||
|
|
||||||
WaitHandle.WaitAll(wait);
|
WaitHandle.WaitAll(wait);
|
||||||
|
|
||||||
|
@ -17,13 +17,27 @@ public static partial class HttpClientHelper
|
|||||||
using HttpClient client = new();
|
using HttpClient client = new();
|
||||||
|
|
||||||
if (port == 80)
|
if (port == 80)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
client.BaseAddress = new($"http://{url}");
|
client.BaseAddress = new($"http://{url}");
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
client.BaseAddress = new($"https://{url}");
|
client.BaseAddress = new($"https://{url}");
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
client.DefaultRequestHeaders.Accept.Clear();
|
client.DefaultRequestHeaders.Accept.Clear();
|
||||||
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgentHeader);
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgentHeader);
|
||||||
@ -86,13 +100,27 @@ public static partial class HttpClientHelper
|
|||||||
using HttpClient client = new();
|
using HttpClient client = new();
|
||||||
|
|
||||||
if (port == 80)
|
if (port == 80)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
client.BaseAddress = new($"http://{url}");
|
client.BaseAddress = new($"http://{url}");
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
client.BaseAddress = new($"https://{url}");
|
client.BaseAddress = new($"https://{url}");
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
client.DefaultRequestHeaders.Accept.Clear();
|
client.DefaultRequestHeaders.Accept.Clear();
|
||||||
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgentHeader);
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgentHeader);
|
||||||
|
@ -9,8 +9,15 @@ useHead({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NuxtLayout>
|
<div class="navbar navbar-expand-md navbar-dark bg-dark">
|
||||||
|
<ul>
|
||||||
|
<li><nuxt-link to="/">Search</nuxt-link></li>
|
||||||
|
<li><nuxt-link to="/progress">Progress</nuxt-link></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<NuxtPage page-key="static" />
|
<NuxtPage page-key="static" />
|
||||||
</NuxtLayout>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
@ -13,5 +13,9 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
nitro: {
|
||||||
|
static: true,
|
||||||
|
},
|
||||||
|
|
||||||
modules: ['@nuxtjs/tailwindcss', 'nuxt-purgecss'],
|
modules: ['@nuxtjs/tailwindcss', 'nuxt-purgecss'],
|
||||||
});
|
});
|
@ -1,12 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const route = useRoute()
|
const value = ref<string | null>(null)
|
||||||
|
|
||||||
|
// https://nuxt.com/docs/api/components/nuxt-link#nuxtlink
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="h-screen flex items-center justify-center">
|
<div class="h-screen flex items-center justify-center">
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<input placeholder=".NET C#" class="text-center bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg p-2.5 w-192"/>
|
<input v-model="value" placeholder=".NET C#" class="text-center bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg p-2.5 w-192"/>
|
||||||
<button class="text-gray-900 bg-gray-50 border border-gray-300 px-4 py-2 rounded-lg">Search</button>
|
<nuxt-link :to="`/searchResult?search=${value}`" class="text-gray-900 bg-gray-50 border border-gray-300 px-4 py-2 rounded-lg">Search</nuxt-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
8
frontend/pages/searchResult.vue
Normal file
8
frontend/pages/searchResult.vue
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const route = useRoute();
|
||||||
|
console.log(route.query);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
Loading…
Reference in New Issue
Block a user