feat: fix ipv6 hint

This commit is contained in:
NoobTW 2023-10-10 11:40:15 +08:00
parent 4a0cdacc05
commit a4d3b069c5

View file

@ -24,25 +24,25 @@ function IPv6AutoAssign({ id, v6AssignMode, handleChange }) {
/> />
<span>ZeroTier RFC4193 (/128 for each device)</span> <span>ZeroTier RFC4193 (/128 for each device)</span>
{v6AssignMode["rfc4193"] && ( {v6AssignMode["rfc4193"] && (
<div> <div style={{ marginLeft: '4rem', letterSpacing: '1px' }}>
<small style={{ marginLeft: '2rem', letterSpacing: '1px' }}> <code>
<code> fd
fd <span style={{ backgroundColor: '#ffffcc' }}>{id.slice(0, 2)}</span>
<span style={{ backgroundColor: '#ffffcc' }}>{id.slice(0, 2)}</span> :
: <span style={{ backgroundColor: '#ffffcc' }}>{id.slice(2, 6)}</span>
<span style={{ backgroundColor: '#ffffcc' }}>{id.slice(2, 6)}</span> :
: <span style={{ backgroundColor: '#ffffcc' }}>{id.slice(6, 10)}</span>
<span style={{ backgroundColor: '#ffffcc' }}>{id.slice(6, 10)}</span> :
: <span style={{ backgroundColor: '#ffffcc' }}>{id.slice(10, 14)}</span>
<span style={{ backgroundColor: '#ffffcc' }}>{id.slice(10, 12)}</span> :
99:93 <span style={{ backgroundColor: '#ffffcc' }}>{id.slice(14, 16)}</span>
<span style={{ backgroundColor: '#ccffff' }}>__</span> 99:93
: <span style={{ backgroundColor: '#ccffff' }}>__</span>
<span style={{ backgroundColor: '#ccffff' }}>____</span> :
: <span style={{ backgroundColor: '#ccffff' }}>____</span>
<span style={{ backgroundColor: '#ccffff' }}>____</span> :
</code> <span style={{ backgroundColor: '#ccffff' }}>____</span>
</small> </code>
</div> </div>
)} )}
</Grid> </Grid>
@ -61,6 +61,38 @@ function IPv6AutoAssign({ id, v6AssignMode, handleChange }) {
}} }}
/> />
<span>ZeroTier 6PLANE (/80 routable for each device)</span> <span>ZeroTier 6PLANE (/80 routable for each device)</span>
{v6AssignMode["6plane"] && (
<div style={{ marginLeft: '4rem', letterSpacing: '1px' }}>
<code>
fc
{
(() => {
const sixPlaneID = id.match(/.{1,2}/g)
.map((substr, idx, arr) => parseInt(substr, 16) ^ parseInt(arr[idx + 4], 16))
.map((byte) => byte.toString(16).toLowerCase())
.map((byte) => (byte.length === 2) ? byte : '0' + byte)
.slice(0, 4)
.join('')
return (
<>
<span style={{ backgroundColor: '#ffffcc' }}>{sixPlaneID.slice(0, 2)}</span>
:
<span style={{ backgroundColor: '#ffffcc' }}>{sixPlaneID.slice(2, 6)}</span>
:
<span style={{ backgroundColor: '#ffffcc' }}>{sixPlaneID.slice(6, 8)}</span>
</>
)
})()
}
<span style={{ backgroundColor: '#ccffff' }}>__</span>
:
<span style={{ backgroundColor: '#ccffff' }}>____</span>
:
<span style={{ backgroundColor: '#ccffff' }}>____</span>
:0000:0000:0001
</code>
</div>
)}
</Grid> </Grid>
{/* TODO: Implement v6 ipAssignmentPools, might break ipv4 pool settings */} {/* TODO: Implement v6 ipAssignmentPools, might break ipv4 pool settings */}