This commit is contained in:
2025-02-09 08:55:01 +01:00
parent 1d631fec21
commit 7b69719f0e
38 changed files with 798 additions and 918 deletions

Binary file not shown.

View File

@@ -1,26 +1,25 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.clients.mycelium
import freeflowuniverse.herolib.clients.mycelium
mycelium.delete()!
mut r:=mycelium.inspect()!
println("My pub key: ${r.public_key}")
mut r := mycelium.inspect()!
println('My pub key: ${r.public_key}')
mut client := mycelium.get()!
println(client)
// Send a message to a node by public key
// Parameters: public_key, payload, topic, wait_for_reply
msg := client.send_msg(
r.public_key, // destination public key
'Hello World', // message payload
'greetings', // optional topic
false // wait for reply
)!
msg := client.send_msg(r.public_key, // destination public key
'Hello World', // message payload
'greetings', // optional topic
false // wait for reply
)!
println('Sent message ID: ${msg.id}')
println("send succeeded")
println('send succeeded')
// Receive messages
// Parameters: wait_for_message, peek_only, topic_filter
@@ -40,4 +39,4 @@ println('Message payload: ${received.payload}')
// status := client.get_msg_status(msg.id)!
// println('Message status: ${status.state}')
// println('Created at: ${status.created}')
// println('Expires at: ${status.deadline}')
// println('Expires at: ${status.deadline}')

View File

@@ -4,13 +4,11 @@ import freeflowuniverse.herolib.develop.gittools
import freeflowuniverse.herolib.osal
import time
mut gs := gittools.new()!
mydocs_path:=gs.get_path(
pull:true,
reset:false,
url:'https://git.ourworld.tf/tfgrid/info_docs_depin/src/branch/main/docs'
mydocs_path := gs.get_path(
pull: true
reset: false
url: 'https://git.ourworld.tf/tfgrid/info_docs_depin/src/branch/main/docs'
)!
println(mydocs_path)

View File

@@ -1,26 +1,23 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.installers.net.mycelium as mycelium_installer
import freeflowuniverse.herolib.clients.mycelium
import freeflowuniverse.herolib.clients.mycelium
mut installer:=mycelium_installer.get()!
mut installer := mycelium_installer.get()!
installer.start()!
mut r:=mycelium.inspect()!
mut r := mycelium.inspect()!
println(r)
mut client := mycelium.get()!
// Send a message to a node by public key
// Parameters: public_key, payload, topic, wait_for_reply
msg := client.send_msg(
'abc123...', // destination public key
'Hello World', // message payload
'greetings', // optional topic
true // wait for reply
)!
msg := client.send_msg('abc123...', // destination public key
'Hello World', // message payload
'greetings', // optional topic
true // wait for reply
)!
println('Sent message ID: ${msg.id}')
// Receive messages
@@ -30,15 +27,14 @@ println('Received message from: ${received.src_pk}')
println('Message payload: ${received.payload}')
// Reply to a message
client.reply_msg(
received.id, // original message ID
received.src_pk, // sender's public key
'Got your message!', // reply payload
'greetings' // topic
)!
client.reply_msg(received.id, // original message ID
received.src_pk, // sender's public key
'Got your message!', // reply payload
'greetings' // topic
)!
// Check message status
status := client.get_msg_status(msg.id)!
println('Message status: ${status.state}')
println('Created at: ${status.created}')
println('Expires at: ${status.deadline}')
println('Expires at: ${status.deadline}')

View File

@@ -2,5 +2,5 @@
import freeflowuniverse.herolib.installers.sysadmintools.zinit as zinit_installer
mut installer:=zinit_installer.get()!
mut installer := zinit_installer.get()!
installer.start()!

View File

@@ -2,24 +2,23 @@
import freeflowuniverse.herolib.osal.tun
// Check if TUN is available
if available := tun.available() {
if available {
println('TUN is available on this system')
// Get a free TUN interface name
if interface_name := tun.free() {
println('Found free TUN interface: ${interface_name}')
// Example: Now you could use this interface name
// to set up your tunnel
} else {
println('Error finding free interface: ${err}')
}
} else {
println('TUN is not available on this system')
}
if available {
println('TUN is available on this system')
// Get a free TUN interface name
if interface_name := tun.free() {
println('Found free TUN interface: ${interface_name}')
// Example: Now you could use this interface name
// to set up your tunnel
} else {
println('Error finding free interface: ${err}')
}
} else {
println('TUN is not available on this system')
}
} else {
println('Error checking TUN availability: ${err}')
println('Error checking TUN availability: ${err}')
}

View File

@@ -7,10 +7,10 @@ import freeflowuniverse.herolib.core.base
import time
import os
//herocompile means we do it for the host system
// herocompile means we do it for the host system
mut pm := herocontainers.new(herocompile: false, install: false)!
//pm.builder_base(reset:true)!
// pm.builder_base(reset:true)!
mut builder := pm.builder_get('base')!
builder.shell()!
@@ -22,7 +22,7 @@ println(builder)
// bash & python can be executed directly in build container
// any of the herocommands can be executed like this
//mybuildcontainer.run(cmd: 'installers -n heroweb', runtime: .herocmd)!
// mybuildcontainer.run(cmd: 'installers -n heroweb', runtime: .herocmd)!
// //following will execute heroscript in the buildcontainer
// mybuildcontainer.run(

View File

@@ -5,16 +5,15 @@ import freeflowuniverse.herolib.web.docusaurus
// Create a new docusaurus factory
mut docs := docusaurus.new(
// build_path: '/tmp/docusaurus_build'
build_path: '/tmp/docusaurus_build'
)!
// Create a new docusaurus site
mut site := docs.dev(
url:'https://git.ourworld.tf/despiegk/docs_kristof'
url: 'https://git.ourworld.tf/despiegk/docs_kristof'
)!
//FOR FUTURE TO ADD CONTENT FROM DOCTREE
// FOR FUTURE TO ADD CONTENT FROM DOCTREE
// Create a doctree for content
// mut tree := doctree.new(name: 'content')!
@@ -34,10 +33,10 @@ mut site := docs.dev(
// )!
// Build the docusaurus site
//site.build()!
// site.build()!
// Generate the static site
//site.generate()!
// site.generate()!
// Optionally open the site in a browser
// site.open()!