Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
//go:build !windows && !plan9
|
|
|
|
package mygo
|
|
|
|
import (
|
|
"os"
|
|
"reflect"
|
|
"sync/atomic"
|
|
"syscall"
|
|
)
|
|
|
|
// fileStatType is the type of the os package's FileInfo, once seen.
|
|
var fileStatType atomic.Pointer[reflect.Type]
|
|
|
|
// rememberFileStatType stores t, in a function of its own so that only a
|
|
// call that stores it moves a copy of t to the heap.
|
|
//
|
|
//go:noinline
|
|
func rememberFileStatType(t reflect.Type) { fileStatType.Store(&t) }
|
|
|
|
// fileWatchIdentity returns the identity os.SameFile compares, the device
|
|
// and inode of the os package's fileStat (os/types_unix.go). Another
|
|
// FileInfo, which os.SameFile takes for no file, has none.
|
|
func fileWatchIdentity(info os.FileInfo) (fileWatchID, bool) {
|
|
t := reflect.TypeOf(info)
|
|
if t == nil {
|
|
return fileWatchID{}, false
|
|
}
|
|
if known := fileStatType.Load(); known == nil || *known != t {
|
|
if t.Kind() != reflect.Pointer || t.Elem().Name() != "fileStat" || t.Elem().PkgPath() != "os" {
|
|
return fileWatchID{}, false
|
|
}
|
|
rememberFileStatType(t)
|
|
}
|
|
st, ok := info.Sys().(*syscall.Stat_t)
|
|
if !ok {
|
|
return fileWatchID{}, false
|
|
}
|
|
return fileWatchID{volume: uint64(st.Dev), index: uint64(st.Ino)}, true
|
|
}
|