Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,9 @@
/* dns_query.wren */
class Net {
foreign static lookupHost(host)
}
var host = "orange.kame.net"
var addrs = Net.lookupHost(host).split(", ")
System.print(addrs.join("\n"))

View file

@ -0,0 +1,31 @@
/* go run dns_query.go */
package main
import(
wren "github.com/crazyinfin8/WrenGo"
"net"
"strings"
)
type any = interface{}
func lookupHost(vm *wren.VM, parameters []any) (any, error) {
host := parameters[1].(string)
addrs, err := net.LookupHost(host)
if err != nil {
return nil, nil
}
return strings.Join(addrs, ", "), nil
}
func main() {
vm := wren.NewVM()
fileName := "dns_query.wren"
methodMap := wren.MethodMap{"static lookupHost(_)": lookupHost}
classMap := wren.ClassMap{"Net": wren.NewClass(nil, nil, methodMap)}
module := wren.NewModule(classMap)
vm.SetModule(fileName, module)
vm.InterpretFile(fileName)
vm.Free()
}