3 Pickle(pack
:Pack unpack
:Unpack
)
7 SerializationUtils(toAlpha
:ToAlpha
8 completeTokens
:CompleteTokens
)
9 DistFramework(session
:Session
)
14 fun{InternalLayerPort LM ?Uri
}
16 ThisDest
={Port
.new
{Cell
.new $ Tail
}}
25 Uri
='dist
-base
:internals'
33 meth serializeDest(D $
)
34 {Connection
.offerMany D
}
36 meth deserializeDest(D $
)
40 {Port
.send D
iMsg(ThisDest M
)}
47 fun{InternalLayerSocket LM ?Uri
}
50 P
in ["127." "169.254." "192.168."
51 "172.16." "172.17." "172.18." "172.19."
52 "172.20." "172.21." "172.22." "172.23."
53 "172.24." "172.25." "172.26." "172.27."
54 "172.28." "172.29." "172.30." "172.31."
58 if {List
.isPrefix P IP1
} then {R
false} end
59 if {List
.isPrefix P IP2
} then {R
true} end
64 {OS
.getHostByName
"localhost"}.addrList
65 {OS
.getHostByName
{OS
.uName
}.nodename
}.addrList
67 {List
.sort IPs BetterIP
}.1
70 RPort
={Port
.new
{Cell
.new $ Tail
}}
78 ServSocket
={New Open
.socket
init()}
79 TCPPort
={ServSocket
bind(port
:$
)}
80 ThisDest
=site(id
:{NewName
} host
:{GetHost
} port
:TCPPort
)
85 ThatSocket
={ServSocket
87 acceptClass
:Open
.socket
)}
90 %%{Browse bytes(Bytes)}
91 {ThatSocket
read(list
:Bytes size
:all
)}
94 %%{Browse blobs(Blobs)}
95 Blobs
={CompleteTokens Bytes
[&,]}
99 Msgs
={Map Blobs Unpack
}
104 {Port
.send RPort
iMsg(Src M
)}
112 Connections
={Dictionary
.new
}
114 Uri
='dist
-base
:internals'
122 meth serializeDest(D $
)
125 meth deserializeDest(D $
)
130 case {Dictionary
.condExchange
131 Connections D
.id
unit $ P
}
133 ThatSocket
={New Open
.socket
client(host
:D
.host
137 write(vs
:{ToAlpha
{Pack ThisDest
} ","})}
143 write(vs
:{ToAlpha
{Pack M
} ","})}