aboutsummaryrefslogtreecommitdiffhomepage
path: root/system/internal/xcb/changehosts.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-30 20:02:18 +0900
committerOphestra <cat@gensokyo.uk>2025-08-30 20:02:18 +0900
commitddb003e39b64c2417cabc291383d99b4ad64ac8f (patch)
tree143ad59a7262ae9186d9266a4b5062feba231ba9 /system/internal/xcb/changehosts.go
parentb12c290f12ab65754d6ce8a461fe641e245cb09c (diff)
system/internal/xcb: refactor and clean up
This package still does not deserve to be out of internal, but at least it is less haunting now. I am still not handling the xcb error though, the struct is almost entirely undocumented and the implementation is unreadable. Not even going to try. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/internal/xcb/changehosts.go')
-rw-r--r--system/internal/xcb/changehosts.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/system/internal/xcb/changehosts.go b/system/internal/xcb/changehosts.go
new file mode 100644
index 00000000..8b05614b
--- /dev/null
+++ b/system/internal/xcb/changehosts.go
@@ -0,0 +1,17 @@
+package xcb
+
+import "errors"
+
+var ErrChangeHosts = errors.New("xcb_change_hosts() failed")
+
+func ChangeHosts(mode HostMode, family Family, address string) error {
+ conn := new(connection)
+ if err := conn.connect(); err != nil {
+ conn.disconnect()
+ return err
+ } else {
+ defer conn.disconnect()
+ }
+
+ return conn.changeHostsChecked(mode, family, address)
+}