55 "errors"
66 "fmt"
77 "strings"
8+ "sync/atomic"
89 "time"
910
1011 "UWP-TCP-Con/internal/ping"
@@ -291,7 +292,9 @@ func (a *App) executeDirect(config DirectConfig) error {
291292 ctx , cancel := context .WithTimeout (context .Background (), a .inputTimeout )
292293 defer cancel ()
293294
294- resultText , err := withSpinner ("Abfrage" , "Server wird abgefragt" , 120 * time .Millisecond , func () (string , error ) {
295+ resultText , err := withSpinner ("Abfrage" , func () string {
296+ return "Server wird abgefragt"
297+ }, 120 * time .Millisecond , func () (string , error ) {
295298 result , err := ping .Execute (ctx , config .Edition , config .Host , config .Port )
296299 if err != nil {
297300 return "" , err
@@ -309,14 +312,29 @@ func (a *App) executeDirect(config DirectConfig) error {
309312func (a * App ) executeLookup (config LookupConfig ) error {
310313 ctx := context .Background ()
311314
312- resultText , err := withSpinner ("IP Lookup" , "Domains werden überprüft" , 120 * time .Millisecond , func () (string , error ) {
315+ var current atomic.Value
316+ current .Store ("Domains werden überprüft" )
317+ formatProgress := func (subdomain , ending string ) string {
318+ sub := subdomain
319+ if sub == "" {
320+ sub = "(keine)"
321+ }
322+ return fmt .Sprintf ("Subdomain: %s | Endung: %s" , sub , ending )
323+ }
324+
325+ resultText , err := withSpinner ("IP Lookup" , func () string {
326+ return current .Load ().(string )
327+ }, 120 * time .Millisecond , func () (string , error ) {
313328 result , lookupErr := ping .LookupDomains (ctx , ping.LookupConfig {
314329 Edition : config .Edition ,
315330 Port : config .Port ,
316331 BaseHost : config .BaseHost ,
317332 Subdomains : config .Subdomains ,
318333 DomainEndings : config .Endings ,
319334 Concurrency : 24 ,
335+ Progress : func (subdomain , ending string ) {
336+ current .Store (formatProgress (subdomain , ending ))
337+ },
320338 })
321339 if lookupErr != nil {
322340 return "" , lookupErr
0 commit comments