@@ -103,10 +103,11 @@ type PeerInfo struct {
103
103
104
104
// StreamSourceInfo shows information about an upstream stream source.
105
105
type StreamSourceInfo struct {
106
- Name string `json:"name"`
107
- Lag uint64 `json:"lag"`
108
- Active time.Duration `json:"active"`
109
- Error * ApiError `json:"error,omitempty"`
106
+ Name string `json:"name"`
107
+ External * ExternalStream `json:"external,omitempty"`
108
+ Lag uint64 `json:"lag"`
109
+ Active time.Duration `json:"active"`
110
+ Error * ApiError `json:"error,omitempty"`
110
111
}
111
112
112
113
// StreamSource dictates how streams can source from other streams.
@@ -117,7 +118,7 @@ type StreamSource struct {
117
118
FilterSubject string `json:"filter_subject,omitempty"`
118
119
External * ExternalStream `json:"external,omitempty"`
119
120
120
- // Internal
121
+ // Internale
121
122
iname string // For indexing when stream names are the same for multiple sources.
122
123
}
123
124
@@ -1151,7 +1152,20 @@ func (mset *stream) sourceInfo(si *sourceInfo) *StreamSourceInfo {
1151
1152
if si == nil {
1152
1153
return nil
1153
1154
}
1154
- return & StreamSourceInfo {Name : si .name , Lag : si .lag , Active : time .Since (si .last ), Error : si .err }
1155
+ ssi := & StreamSourceInfo {Name : si .name , Lag : si .lag , Active : time .Since (si .last ), Error : si .err }
1156
+ var ext * ExternalStream
1157
+ if mset .cfg .Mirror != nil {
1158
+ ext = mset .cfg .Mirror .External
1159
+ } else if ss := mset .streamSource (si .iname ); ss != nil && ss .External != nil {
1160
+ ext = ss .External
1161
+ }
1162
+ if ext != nil {
1163
+ ssi .External = & ExternalStream {
1164
+ ApiPrefix : ext .ApiPrefix ,
1165
+ DeliverPrefix : ext .DeliverPrefix ,
1166
+ }
1167
+ }
1168
+ return ssi
1155
1169
}
1156
1170
1157
1171
// Return our source info for our mirror.
@@ -1563,9 +1577,9 @@ func (mset *stream) setupMirrorConsumer() error {
1563
1577
return nil
1564
1578
}
1565
1579
1566
- func (mset * stream ) streamSource (sname string ) * StreamSource {
1580
+ func (mset * stream ) streamSource (iname string ) * StreamSource {
1567
1581
for _ , ssi := range mset .cfg .Sources {
1568
- if ssi .Name == sname {
1582
+ if ssi .iname == iname {
1569
1583
return ssi
1570
1584
}
1571
1585
}
@@ -1626,7 +1640,7 @@ func (mset *stream) setSourceConsumer(iname string, seq uint64) {
1626
1640
1627
1641
si .sseq , si .dseq = seq , 0
1628
1642
si .last = time .Now ()
1629
- ssi := mset .streamSource (si . name )
1643
+ ssi := mset .streamSource (iname )
1630
1644
1631
1645
// Determine subjects etc.
1632
1646
var deliverSubject string
0 commit comments